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
This commit is contained in:
parent
c398e83893
commit
0d34c28199
@ -24,6 +24,7 @@ def create(attrs = {}, replace_existing = true)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create!(attrs = {}, replace_existing = true)
|
def create!(attrs = {}, replace_existing = true)
|
||||||
|
load_target if replace_existing
|
||||||
record = @reflection.klass.with_scope(:create => construct_scope[:create]) { @reflection.klass.create!(attrs) }
|
record = @reflection.klass.with_scope(:create => construct_scope[:create]) { @reflection.klass.create!(attrs) }
|
||||||
|
|
||||||
if replace_existing
|
if replace_existing
|
||||||
|
Loading…
Reference in New Issue
Block a user