diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index b4908eec9d..77fc827e11 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -85,7 +85,7 @@ module ActiveRecord end def conditions - @conditions ||= interpolate_sql(sanitize_sql(@reflection.options[:conditions])) if @reflection.options[:conditions] + @conditions ||= interpolate_sql(@reflection.sanitized_conditions) if @reflection.sanitized_conditions end alias :sql_conditions :conditions diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 8614ef8751..3f74c03714 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -112,6 +112,10 @@ module ActiveRecord name == other_aggregation.name && other_aggregation.options && active_record == other_aggregation.active_record end + def sanitized_conditions #:nodoc: + @sanitized_conditions ||= klass.send(:sanitize_sql, options[:conditions]) if options[:conditions] + end + private def derive_class_name name.to_s.camelize |