How to determine if association has changed in ActiveRecord?

ActiveRecord offers change tracking, where the call #name_changed?returns true / false depending on whether the attribute has changed namebetween when the model was loaded and now.

Is there an equivalent for associations? I am specifically looking for has_many associations, but all types of associations would be helpful.

Rails 5.2, Ruby 2.5.1

+4
source share

Source: https://habr.com/ru/post/1695632/


All Articles