-
Notifications
You must be signed in to change notification settings - Fork 895
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
Can not store meta data on create operation, but creating being update operation in model. #185
Comments
Note, that on an initial If you want the metadata to be filled on has_paper_trail :ignore => [:user_id],
:meta => {
:hotel_id => Proc.new { |hotel| hotel.id },
:agent_user_id => Proc.new { |hotel| hotel.user_id }
} |
Following code block working for me, has_paper_trail :ignore => [:user_id], :meta => {:hotel_id => Proc.new { |hotel| hotel.id }, :agent_user_id => Proc.new { |hotel| hotel.user_id } } thank a lot 👍 |
Thanks for this thread, folks, very helpful. It wouldn't hurt for this howto to be added to the README too: I think it comes in handy when you are doing something like the following very common case: I have a parent object A and a set of child objects B, C, and D. I want to be able to readily view all versions of A and its child objects, by selecting all the versions where a metadata column matches A's id. But when I create a new child object E, its metadata column doesn't get populated by the Anyway, the fix is easy enough to find in this thread, so I guess anyone motivated can look it up like I just did. |
@decasia - In terms of restoring relationships when reifying, there is already some support for restoring If you have a suggestion for how the above information can be explained clearly and succinctly in a helpful way on the README, please make a pull request. |
+1 to add this to the readme. |
I have something like following in my model but data not set to hotel_id and agent_user_id while creating the object. Can not figure it out. I have hotel_id and agent_user_id in my version table. I also use
attr_accessible :hotel_id, :agent_user_id
in paper_trail.rbwhat is happening here?
The text was updated successfully, but these errors were encountered: