提交 5ecf6922 编写于 作者: J Jon Leighton 提交者: Aaron Patterson

merge_with_conditions is not necessary because the conditions will already be...

merge_with_conditions is not necessary because the conditions will already be in the scope_for_create hash in the scope
上级 45d0d18b
......@@ -4,21 +4,18 @@ module Associations
class HasOneAssociation < AssociationProxy #:nodoc:
def create(attrs = {})
new_record do |reflection|
attrs = merge_with_conditions(attrs)
reflection.create_association(attrs)
end
end
def create!(attrs = {})
new_record do |reflection|
attrs = merge_with_conditions(attrs)
reflection.create_association!(attrs)
end
end
def build(attrs = {})
new_record do |reflection|
attrs = merge_with_conditions(attrs)
reflection.build_association(attrs)
end
end
......@@ -77,12 +74,6 @@ def new_record
replace(record, true)
record
end
def merge_with_conditions(attrs={})
attrs ||= {}
attrs.update(@reflection.options[:conditions]) if @reflection.options[:conditions].is_a?(Hash)
attrs
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册