From 569be76ed6e813c854ac31958f547a5d4acfb5da Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Wed, 22 Sep 2010 11:04:11 -0300 Subject: Use map instead inject. Signed-off-by: Santiago Pastorino --- activerecord/lib/active_record/persistence.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 1b016f0895..f80e304c5d 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -279,10 +279,9 @@ module ActiveRecord # that a new instance, or one populated from a passed-in Hash, still has all the attributes # that instances loaded from the database would. def attributes_from_column_definition - self.class.columns.inject({}) do |attributes, column| - attributes[column.name] = column.default unless column.name == self.class.primary_key - attributes - end + Hash[self.class.columns.map do |column| + [column.name, column.default] unless column.name == self.class.primary_key + end] end end end -- cgit v1.2.3