From 5ecf6922487b5476509af2a89137c3cd3791f7ab Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 6 Jan 2011 19:35:19 +0000 Subject: [PATCH] merge_with_conditions is not necessary because the conditions will already be in the scope_for_create hash in the scope --- .../active_record/associations/has_one_association.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index bee5700bfc..285c2631ad 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -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 -- GitLab