lib/active_remote/dirty.rb in active_remote-1.3.3 vs lib/active_remote/dirty.rb in active_remote-1.4.0

- old
+ new

@@ -49,9 +49,18 @@ record.changed_attributes.try(:clear) end end end + # Override #write_attribute (along with #[]=) so we can provide support for + # ActiveModel::Dirty. + # + def write_attribute(name, value) + __send__("#{name}_will_change!") unless value == self[name] + super + end + alias_method :[]=, :write_attribute + private # Override ActiveAttr's attribute= method so we can provide support for # ActiveModel::Dirty. #