diff options
author | Les Fletcher <les.fletcher@gmail.com> | 2011-07-21 01:36:02 -0700 |
---|---|---|
committer | Gabriel Horner <gabriel.horner@gmail.com> | 2011-07-24 00:31:28 -0400 |
commit | f956759f8ab656484add2d5bc6e8f6f4add79469 (patch) | |
tree | 3783716dfd568e2b9c61dfb4daf310031ebb0ef1 /activerecord/lib/active_record | |
parent | d33eb07543aed1a07f9efe40ff7edc983b401957 (diff) | |
download | rails-f956759f8ab656484add2d5bc6e8f6f4add79469.tar.gz rails-f956759f8ab656484add2d5bc6e8f6f4add79469.tar.bz2 rails-f956759f8ab656484add2d5bc6e8f6f4add79469.zip |
fix after_initialize edge case (close #2074 and close #2175)
fix behavior when after_initialize is defined and a block is passed to Base.create
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 3 |
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 |