【发布时间】:2012-02-21 18:03:48
【问题描述】:
我需要跟踪这样设置的关联的更改(添加和删除):
has_many :listing_services
has_many :services, through: :listing_services
对于普通属性,最简单的方法是在before_save 中检查l.changes[attribute] 或在after_save 中检查l.previous_changes[attribute]。
问题是,对于has_many 属性,最好的方法是什么?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 activerecord has-many