diff options
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 378fc79949..1152846df2 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -14,7 +14,7 @@ module ActiveRecord "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 diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 795eddd511..f2652f55cc 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -9,7 +9,7 @@ module ActiveRecord @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] |