From 0d34c28199839882076e95a20bcae0be44345a1c Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 11 Jan 2007 18:10:42 +0000 Subject: treat create! like create and make sure the target is loaded first git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5882 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/has_one_association.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 8d24c43a1f..757895b6b4 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -24,6 +24,7 @@ module ActiveRecord end def create!(attrs = {}, replace_existing = true) + load_target if replace_existing record = @reflection.klass.with_scope(:create => construct_scope[:create]) { @reflection.klass.create!(attrs) } if replace_existing -- cgit v1.2.3