diff options
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 31b8ac6b9e..847709df8c 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -66,7 +66,9 @@ module ActiveRecord load_target.select { |record| ids.include?(record.id) } end else - options[:conditions] = @finder_sql + (options[:conditions] ? " AND #{options[:conditions]}" : "") + if options[:conditions] = sanitize_sql(options[:conditions]) + options[:conditions] = "#{@finder_sql} AND #{options[:conditions]}" + end if options[:order] && @options[:order] options[:order] = "#{options[:order]}, #{@options[:order]}" |