diff options
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/where_clause_factory.rb | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 550416238f..ecce949370 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -84,7 +84,6 @@ module ActiveRecord return ["1=0"] if attributes.empty? attributes.flat_map do |key, value| - key = key.to_s if value.is_a?(Hash) associated_predicate_builder(key).expand_from_hash(value) else @@ -137,11 +136,11 @@ module ActiveRecord end def convert_dot_notation_to_hash(attributes) - dot_notation = attributes.keys.select do |s| - s.respond_to?(:include?) && s.include?(".".freeze) + dot_notation = attributes.select do |k, v| + k.include?(".".freeze) && !v.is_a?(Hash) end - dot_notation.each do |key| + dot_notation.each_key do |key| table_name, column_name = key.split(".".freeze) value = attributes.delete(key) attributes[table_name] ||= {} diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb index c0ccb00b6f..dbf172a577 100644 --- a/activerecord/lib/active_record/relation/where_clause_factory.rb +++ b/activerecord/lib/active_record/relation/where_clause_factory.rb @@ -15,6 +15,7 @@ module ActiveRecord when Hash attributes = predicate_builder.resolve_column_aliases(opts) attributes = klass.send(:expand_hash_conditions_for_aggregates, attributes) + attributes.stringify_keys! attributes, binds = predicate_builder.create_binds(attributes) |