-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
Fix paper trail compatibility #298
Fix paper trail compatibility #298
Conversation
… ActiveRecord model.
…ks #has_paper_trail, if you want to use #translates and #has_paper_trail in the same model.
…ou should use has_paper_trail first.
Thanks very much for this! We'll have a look asap and get back to you. |
We're currently refactoring internals (see #294) to extract the versioning functionality into a separate gem, globalize-versioning. It would be great if we could merge these efforts. @parndt how's that going? |
I haven't made any further progress unfortunately as I've been super busy with rubyconf! |
No it should also support |
@shioyama I didn't know about I added my comment to that thread. |
well paper_trail is already supported by globalize so updates should be made to improve compatibility. Vestal versions is totally unrelated to this |
@etagwerker Really sorry for the delay. As you can see I've started a discussion on the new |
I've just released Globalize 3.0.4 with versioning extracted and earlier released 4.0.0 also with no versioning. To use versioning, you now have to add the globalize-versioning gem. I'm going to close this but please have a look at the new gem and report any issues to the issue tracker there. Thanks! |
Hello!
This is a proposed solution to issue #206, for the case where a model has both
has_paper_trail
andtranslates :versioning => true
I've added the case to the set of tests.
The code will only delegate #version and #versions to the translation class if the model doesn't already have paper_trail enabled.
I believe there will be a problem if you define your model like this:
The problem will be that
#version
and#versions
will call the translation methods.If you define it like this:
It should work alright.
I understand it's not ideal to have to order the statements, but I wanted to keep the contribution backwards compatible.
With this contribution, if you want to have
has_paper_trail
andtranslates :versioning => true
in the same model, you will have to access versions like this:Any comments will be appreciated.
I hope this helps.
Thanks!