diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-17 20:45:38 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-17 20:45:38 +0000 |
commit | 86da56a6547289515cbb327f3d7423dd226fc31a (patch) | |
tree | c15c7cb4453d368dcb13085c35390b837d68c5b4 /activerecord/lib | |
parent | e9a4e4d88b6377ce1b6167149ea45767018dac65 (diff) | |
download | rails-86da56a6547289515cbb327f3d7423dd226fc31a.tar.gz rails-86da56a6547289515cbb327f3d7423dd226fc31a.tar.bz2 rails-86da56a6547289515cbb327f3d7423dd226fc31a.zip |
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |