Skip to content

Commit

Permalink
Don't add the same conditions twice in has_one finder sql. References #…
Browse files Browse the repository at this point in the history
…2916.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3074 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Nov 17, 2005
1 parent e9a4e4d commit 86da56a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *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.] * 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>] * 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>]
Expand Down
Expand Up @@ -65,7 +65,7 @@ def target_obsolete?
end end


def construct_sql 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 << " AND (#{sanitize_sql(@options[:conditions])})" if @options[:conditions]
@finder_sql @finder_sql
end end
Expand Down

0 comments on commit 86da56a

Please sign in to comment.