From c50113bc6110624bd411466e7c36bdde23226959 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 19 May 2006 01:05:20 +0000 Subject: create! no longer blows up when no attributes are passed and a :create scope is in effect (e.g. foo.bars.create! failed whereas foo.bars.create!({}) didn't.) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4348 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/validations.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 4194e68b2f..29c2b79226 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -712,6 +712,7 @@ module ActiveRecord if attributes.is_a?(Array) attributes.collect { |attr| create!(attr) } else + attributes ||= {} attributes.reverse_merge!(scope(:create)) if scoped?(:create) object = new(attributes) -- cgit v1.2.3