-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in combination with paper_trail gem #395
Comments
This seems like a great idea to be able to customize the base class |
Similar problem here except with a MultiTenant gem. Basically my group hierarchies now also need a column for the tenant id. It's not a huge deal (I can add that column) but it is a breaking change. |
New project, same problem. Found my old issue here because I had the same problem again. ClosureTree is not compatible with ActsAsTenant because it uses raw SQL here. I need |
@AmShaegar13 what versions do you use ? I have a full rewrite incoming, it will support only 7.x for now. |
The current workaround is to use |
Overview
Recent changes introduced in v7.4.0 led to a regression in combination with paper_trail. Specifically, this change:
f3b33f8
Description
We need to track changes to each of our models. For this, we use paper_trail in a base model which is then inherited from. Prior to this change, the ModelHierarchy models did not inherit from our base class. Now they do. This activates paper_trail in the ModelHierarchy models which does not work because paper_trail needs a primary key column. The resulting error when creating a new instance of Model is:
I worked around this by activating paper_trail conditionally only.
However, I wonder if you would like to add an option to use the desired base model with
superclass
being the default. Like:Maybe one could even add this globally to the initializer.
Steps to reproduce
I created a simple rails application to demonstrate the problem:
Demo App
ApplicationRecord (with paper_trail)
Node < ApplicationRecord (with closure_tree)
database.yml
rails db:migrate
rails c
Node.create!(name: 'Foo')
The text was updated successfully, but these errors were encountered: