Skip to content

Commit 5ecf692

Browse files
jonleightontenderlove
authored andcommitted
merge_with_conditions is not necessary because the conditions will already be in the scope_for_create hash in the scope
1 parent 45d0d18 commit 5ecf692

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

activerecord/lib/active_record/associations/has_one_association.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ module Associations
44
class HasOneAssociation < AssociationProxy #:nodoc:
55
def create(attrs = {})
66
new_record do |reflection|
7-
attrs = merge_with_conditions(attrs)
87
reflection.create_association(attrs)
98
end
109
end
1110

1211
def create!(attrs = {})
1312
new_record do |reflection|
14-
attrs = merge_with_conditions(attrs)
1513
reflection.create_association!(attrs)
1614
end
1715
end
1816

1917
def build(attrs = {})
2018
new_record do |reflection|
21-
attrs = merge_with_conditions(attrs)
2219
reflection.build_association(attrs)
2320
end
2421
end
@@ -77,12 +74,6 @@ def new_record
7774
replace(record, true)
7875
record
7976
end
80-
81-
def merge_with_conditions(attrs={})
82-
attrs ||= {}
83-
attrs.update(@reflection.options[:conditions]) if @reflection.options[:conditions].is_a?(Hash)
84-
attrs
85-
end
8677
end
8778
end
8879
end

0 commit comments

Comments
 (0)