How to determine if any field in a model / nested model changed?

To see if a ActiveRecord object has changed, you can call:

instance.changed?

To see if a specific attribute was changed, you can do:

instance.attr_changed?

where attr is the attribute you want to check.

To check for if a nested model changed, you can just do:

instance.nested_model.changed?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)