Skip to content
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

Monitoring changes to associated models #436

Closed
lmorgan-yozu opened this issue Oct 28, 2014 · 2 comments
Closed

Monitoring changes to associated models #436

lmorgan-yozu opened this issue Oct 28, 2014 · 2 comments

Comments

@lmorgan-yozu
Copy link

Hi,

Just wondering if there's a 'standard' or accepted way for monitoring changes to associated models and displaying those changes in the parent's versions.

So for example:

class Account < ActiveRecord::Base
    belongs_to :customer
    has_paper_trail
end

class Customer < ActiveRecord::Base
    has_one :account
    has_paper_trail
end

So within an Account we use nested_attributes to modify the fields within the Customer model, and would like to track and display the changes to that Customer object within Account. At present we're just able to show the changes only to Account's fields, but within the context of our app a user would never look at a Customer object other than through its Account if that makes sense.

I've spent half an hour searching past issues and the documentation and can't see any reference to a scenario as above - not sure if I'm missing something simple or if this is just something Papertrail doesn't cater for? (That is, we'd have to expose Customer's versions separately/independently).

Any advice appreciated!

Thanks.

@batter
Copy link
Collaborator

batter commented Oct 31, 2014

@lmorgan-yozu - There is a section on the README regarding how to deal with versioning has_one associations. Please refer to that.

There is also an open PR #348, but after examining it in detail I thought it was broken, but perhaps I was mistaken and if the current built in functionality doesn't fix your issue, perhaps that will.

@batter
Copy link
Collaborator

batter commented Jan 16, 2015

I have now also released v4.0.0.beta2, which supports versioning of most relational associations, as well as some improvements to the has_one association version restoration, so feel free to give that a whirl for better associative reification support (see #439 for more details). Feel free to ask if you have any questions, I'm going to close this for now unless there's anything more you want to know.

@batter batter closed this as completed Jan 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants