Permalink
Browse files

r3148@asus: jeremy | 2005-11-17 12:45:44 -0800

 Apply [3074] to stable.  Don't add the same conditions twice in has_one finder sql.  Closes #2916.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@3076 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 0023cb1 commit de5980289c2ce0e5134979a6ff838e8ec52a7d41 @jeremy jeremy committed Nov 17, 2005
Showing with 3 additions and 1 deletion.
  1. +2 −0 activerecord/CHANGELOG
  2. +1 −1 activerecord/lib/active_record/associations/has_one_association.rb
View
@@ -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.]
* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]
@@ -65,7 +65,7 @@ def target_obsolete?
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

0 comments on commit de59802

Please sign in to comment.