aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-07-25 07:20:38 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-07-25 07:20:38 -0700
commit64affc9384e9e8845b0204b94c003265442bc3e2 (patch)
tree3621b556f01e3ed95a20abd89cf8c469b186e382 /activerecord/lib
parent14c0f0ee12f87970744e8373b996cb64d7ed37f7 (diff)
parentf5e4d13270dbce2bb880ef6529da68aaee017910 (diff)
downloadrails-64affc9384e9e8845b0204b94c003265442bc3e2.tar.gz
rails-64affc9384e9e8845b0204b94c003265442bc3e2.tar.bz2
rails-64affc9384e9e8845b0204b94c003265442bc3e2.zip
Merge pull request #2236 from cldwalker/after_initialize
Fix after_initialize and Base.create edge case
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/base.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 2c162a6fc8..4136868b39 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -504,8 +504,7 @@ module ActiveRecord #:nodoc:
if attributes.is_a?(Array)
attributes.collect { |attr| create(attr, options, &block) }
else
- object = new(attributes, options)
- yield(object) if block_given?
+ object = new(attributes, options, &block)
object.save
object
end