views:

32

answers:

1

Hi! I have a model that I am attempting to apply optimistic locking to. If the user has a stale record I need the system to display what they entered and ask them to try again. I have attempted to use the changes method, which works. My issue is that the model has many different levels of related models, that are all submitted within the same form. Is it possible to traverse through all of the related models gathering all of the changes, or do I need to do this manually?

Any help would be appreciated!

Thanks,

Ryan Lundie

A: 

Hey, check out this plugin: dirty_associations I think that's what you are looking for.

jpemberthy
Thanks! I will take a look.
lundie
I've gone through dirty_associations but for my purpose it really does not help. I am looking to somehow get a hash (or something) of all of the associations that have changed without specifically outline what each association is. Bassicaly using model.changes and get back the changes for that model as well as its associated models (and their associated models). I may just have to do it manually, but Im worried that doing it that may will break if I end up adding associations in the future.
lundie