diff options
author | Jacob Atzen <jacob@jacobatzen.dk> | 2010-03-12 10:22:29 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-27 10:48:32 +0100 |
commit | a5d637d86c02d911b07d48bdbfbc4f23fb59d720 (patch) | |
tree | 0f79272a6c135a75cac138e79d4a5da628b79c7a /activemodel/lib/active_model/dirty.rb | |
parent | 140cc9caf640d9c32649e396cecbaad3743fd907 (diff) | |
download | rails-a5d637d86c02d911b07d48bdbfbc4f23fb59d720.tar.gz rails-a5d637d86c02d911b07d48bdbfbc4f23fb59d720.tar.bz2 rails-a5d637d86c02d911b07d48bdbfbc4f23fb59d720.zip |
ActiveModel::Dirty#changes should return a HashWithIndifferentAccess [#4157 state:resolved]
Keep the Rails style of inject
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/lib/active_model/dirty.rb')
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index d3a6bad6bb..2f6b30dfed 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -107,7 +107,7 @@ module ActiveModel # person.name = 'bob' # person.changes # => { 'name' => ['bill', 'bob'] } def changes - changed.inject({}) { |h, attr| h[attr] = attribute_change(attr); h } + changed.inject(HashWithIndifferentAccess.new){ |h, attr| h[attr] = attribute_change(attr); h } end # Map of attributes that were changed when the model was saved. |