-
Notifications
You must be signed in to change notification settings - Fork 899
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
Add support for per-model version_limit #915
Add support for per-model version_limit #915
Conversation
Just realised I was only running the Test::Unit suite locally, will take a look at rspec failures shortly. Also, should I have added the new test to the rspec suite? Update Right, so fetching What would you say is the recommended way to access |
What does AST stand for? Are you referring to single table inheritance? What would you say is the recommended way to access paper_trail_options from the Version model? PaperTrail declares a
If that doesn't work due to STI concerns, and you have a separate model class, perhaps you could try something like this?
Can you please elaborate on what your primary concerns are? |
329e1b7
to
fc9d3ec
Compare
Yep, I meant STI of course, sorry :) @batter I think the solution you suggested should cover all the cases, just amended the commit, thanks for your help! Some of the builds are still failing on this test, though. |
fc9d3ec
to
6470edc
Compare
Yeah. It might be because I can tell you for sure that This is a tricky one. It seems you can't call |
6470edc
to
e9527eb
Compare
e9527eb
to
4067fa2
Compare
Spent some time reading paper_trail and activerecord source code trying to figure this out - no luck, unfortunately :( CI only seems to fail for MySQL, I'll try to set it up locally at some point to see if that helps clearing things up.. |
Are you still working on this, Mikhail? Do you want to keep this PR open? Thanks. |
I would still very much like to see this feature in paper_trail :) I'll be on vacation at the end of the month and will likely have time to dig deeper into the issue. Just in case I fail, would you be open to adding this feature without STI support (but with a readme note and a good error message)? |
No, thanks. I'd rather not have the feature, if it can't support STI. |
Closing due to inactivity, but we'll be happy to re-open if you make progress, Mikhail. |
This is the same feature as suggested in #781, but implemented as a
has_paper_trail
option:One thing I was not 100% sure about when implementing the change is whether it's safe to call
item
in theafter_create
callback. I'm not really familiar with the codebase so it's hard to tell if there is a scenario where theitem
is not loaded and this will result in an extra DB query.. please advise :)If that does create an issue the code could be changed to something like
item_type.constantize.paper_trail_options[:version_limit]