aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-22 11:04:11 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-09-22 18:08:02 -0300
commit569be76ed6e813c854ac31958f547a5d4acfb5da (patch)
tree4a5169b2461ba86bc9602c4165e7f25ec97dcb0e
parent090c9ae3a35f9dc4866b52dc696e7d07a5bb7189 (diff)
downloadrails-569be76ed6e813c854ac31958f547a5d4acfb5da.tar.gz
rails-569be76ed6e813c854ac31958f547a5d4acfb5da.tar.bz2
rails-569be76ed6e813c854ac31958f547a5d4acfb5da.zip
Use map instead inject.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r--activerecord/lib/active_record/persistence.rb7
1 files changed, 3 insertions, 4 deletions
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