From 86da56a6547289515cbb327f3d7423dd226fc31a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 17 Nov 2005 20:45:38 +0000 Subject: Don't add the same conditions twice in has_one finder sql. References #2916. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3074 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/has_one_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index edd9e53c19..8f7857ebea 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -65,7 +65,7 @@ module ActiveRecord end def construct_sql - @finder_sql = "#{@association_class.table_name}.#{@association_class_primary_key_name} = #{@owner.quoted_id}#{@options[:conditions] ? " AND " + @options[:conditions] : ""}" + @finder_sql = "#{@association_class.table_name}.#{@association_class_primary_key_name} = #{@owner.quoted_id}" @finder_sql << " AND (#{sanitize_sql(@options[:conditions])})" if @options[:conditions] @finder_sql end -- cgit v1.2.3