method
convert_dot_notation_to_hash
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::PredicateBuilder
convert_dot_notation_to_hash(attributes)private
No documentation available.
# File activerecord/lib/active_record/relation/predicate_builder.rb, line 150
def convert_dot_notation_to_hash(attributes)
attributes.each_with_object({}) do |(key, value), converted|
if value.is_a?(Hash)
if (existing = converted[key])
existing.merge!(value)
else
converted[key] = value.dup
end
elsif (idx = key.rindex("."))
table_name, column_name = key[0, idx], key[idx + 1, key.length]
if (existing = converted[table_name])
existing[column_name] = value
else
converted[table_name] = { column_name => value }
end
else
converted[key] = value
end
end
end