diff options
author | Tristan Dunn <tristanzdunn@gmail.com> | 2009-08-10 00:41:36 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-10 00:41:36 +0100 |
commit | 0472839d684d836e1e7ecd39722c313410d76d5b (patch) | |
tree | cbb7ac14634a388116cc43600ba2c163f0b0532a /activerecord/lib/active_record/base.rb | |
parent | 00d6c766608f90ce64f11feb98786cbc7f71b89d (diff) | |
download | rails-0472839d684d836e1e7ecd39722c313410d76d5b.tar.gz rails-0472839d684d836e1e7ecd39722c313410d76d5b.tar.bz2 rails-0472839d684d836e1e7ecd39722c313410d76d5b.zip |
Prevent overwriting of table name in merging SQL conditions [#2949 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2219edaa3a..c5be561ea3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2294,10 +2294,12 @@ module ActiveRecord #:nodoc: # And for value objects on a composed_of relationship: # { :address => Address.new("123 abc st.", "chicago") } # # => "address_street='123 abc st.' and address_city='chicago'" - def sanitize_sql_hash_for_conditions(attrs, table_name = quoted_table_name) + def sanitize_sql_hash_for_conditions(attrs, default_table_name = quoted_table_name) attrs = expand_hash_conditions_for_aggregates(attrs) conditions = attrs.map do |attr, value| + table_name = default_table_name + unless value.is_a?(Hash) attr = attr.to_s |