diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-01-20 22:58:14 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-01-20 22:58:14 -0200 |
commit | 06a00038efbbaef127ad8908fffea6799c577440 (patch) | |
tree | fbb99094dcb8cbc3ad941a68fcafff23ef328ed1 /activemodel/lib/active_model | |
parent | de3bf3ec3d7dfa81870aca5b8ed8c237e093fe9f (diff) | |
download | rails-06a00038efbbaef127ad8908fffea6799c577440.tar.gz rails-06a00038efbbaef127ad8908fffea6799c577440.tar.bz2 rails-06a00038efbbaef127ad8908fffea6799c577440.zip |
When applying changes or reseting changes create the right class
Before this patch after the changes are applied the changes can be only
accessed using string keys, but before symbols are also accepted.
After this change every state of the model will be consistent.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index 58d87e6f7f..72e2224926 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -167,13 +167,13 @@ module ActiveModel # Removes current changes and makes them accessible through +previous_changes+. def changes_applied @previously_changed = changes - @changed_attributes = {} + @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new end # Removes all dirty data: current changes and previous changes def reset_changes - @previously_changed = {} - @changed_attributes = {} + @previously_changed = ActiveSupport::HashWithIndifferentAccess.new + @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new end # Handle <tt>*_change</tt> for +method_missing+. |