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 | |
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')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index d6464df95d..9897ab237f 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Don't add the same conditions twice in has_one finder sql. #2916 [Jeremy Evans] + * Rename Version constant to VERSION. #2802 [Marcel Molina Jr.] * Introducing the Firebird adapter. Quote columns and use attribute_condition more consistently. Setup guide: http://wiki.rubyonrails.com/rails/pages/Firebird+Adapter #1874 [Ken Kunz <kennethkunz@gmail.com>] 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 |