lib/active_remote/dirty.rb in active_remote-5.1.1 vs lib/active_remote/dirty.rb in active_remote-5.2.0.alpha
- old
+ new
@@ -22,12 +22,11 @@
# Override #reload to provide dirty tracking.
#
def reload(*)
super.tap do
- @previously_changed.try(:clear)
- changed_attributes.clear
+ clear_changes_information
end
end
# Override #remote to provide dirty tracking.
#
@@ -39,23 +38,21 @@
# Override #save to store changes as previous changes then clear them.
#
def save(*)
if (status = super)
- @previously_changed = changes
- changed_attributes.clear
+ changes_applied
end
status
end
# Override #save to store changes as previous changes then clear them.
#
def save!(*)
super.tap do
- @previously_changed = changes
- changed_attributes.clear
+ changes_applied
end
end
def skip_dirty_tracking
disable_dirty_tracking
@@ -75,10 +72,10 @@
# Override ActiveAttr's attribute= method so we can provide support for
# ActiveModel::Dirty.
#
def attribute=(name, value)
- __send__("#{name}_will_change!") if _active_remote_track_changes? && value != self[name]
+ send("#{name}_will_change!") if _active_remote_track_changes? && value != self[name]
super
end
# Override #update to only send changed attributes.
#