From a5d637d86c02d911b07d48bdbfbc4f23fb59d720 Mon Sep 17 00:00:00 2001 From: Jacob Atzen Date: Fri, 12 Mar 2010 10:22:29 +0100 Subject: ActiveModel::Dirty#changes should return a HashWithIndifferentAccess [#4157 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep the Rails style of inject Signed-off-by: José Valim --- activemodel/lib/active_model/dirty.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib/active_model/dirty.rb') 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. -- cgit v1.2.3