Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use map instead inject.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
commit 569be76ed6e813c854ac31958f547a5d4acfb5da 1 parent 090c9ae
@miloops miloops authored spastorino committed
Showing with 3 additions and 4 deletions.
  1. +3 −4 activerecord/lib/active_record/persistence.rb
View
7 activerecord/lib/active_record/persistence.rb
@@ -279,10 +279,9 @@ def create
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.