From f956759f8ab656484add2d5bc6e8f6f4add79469 Mon Sep 17 00:00:00 2001 From: Les Fletcher Date: Thu, 21 Jul 2011 01:36:02 -0700 Subject: 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 --- activerecord/lib/active_record/base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3