Permalink
Browse files

Fixed that conditions in has_many and has_and_belongs_to_many should …

…be interpolated just like the finder_sql is

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@344 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 98c02b9 commit b64004fda68f636cea93b591e3c48c1f096e279d @dhh dhh committed Jan 7, 2005
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that conditions in has_many and has_and_belongs_to_many should be interpolated just like the finder_sql is
+
* Fixed Base#update_attribute to be indifferent to whether a string or symbol is used to describe the name
* Added Base#toggle(attribute) and Base#toggle!(attribute) that makes it easier to flip a switch or flag.
@@ -14,7 +14,7 @@ def initialize(owner, association_name, association_class_name, association_clas
"SELECT t.*, j.* FROM #{association_table_name} t, #{@join_table} j " +
"WHERE t.#{@association_class.primary_key} = j.#{@association_foreign_key} AND " +
"j.#{association_class_primary_key_name} = #{@owner.quoted_id} " +
- (options[:conditions] ? " AND " + options[:conditions] : "") + " " +
+ (options[:conditions] ? " AND " + interpolate_sql(options[:conditions]) : "") + " " +
"ORDER BY #{@order}"
end
@@ -9,7 +9,7 @@ def initialize(owner, association_name, association_class_name, association_clas
@finder_sql = interpolate_sql(options[:finder_sql])
else
@finder_sql = "#{@association_class_primary_key_name} = #{@owner.quoted_id}"
- @finder_sql << " AND #{@conditions}" if @conditions
+ @finder_sql << " AND #{interpolate_sql(@conditions)}" if @conditions
end
if options[:counter_sql]

0 comments on commit b64004f

Please sign in to comment.