1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove duplicated attribute alias resolution

We now always use `arel_attribute` for attribute alias resolution.
This commit is contained in:
Ryuta Kamizono 2020-05-09 05:35:05 +09:00
parent 7ce3451927
commit 56f30962b8
2 changed files with 1 additions and 12 deletions

View file

@ -15,8 +15,7 @@ module ActiveRecord
end
def build_from_hash(attributes)
attributes = table.resolve_column_aliases(attributes)
attributes.stringify_keys!
attributes = attributes.stringify_keys
attributes = convert_dot_notation_to_hash(attributes)
expand_from_hash(attributes)

View file

@ -11,16 +11,6 @@ module ActiveRecord
@association = association
end
def resolve_column_aliases(hash)
new_hash = hash.dup
hash.each_key do |key|
if key.is_a?(Symbol) && new_key = klass.attribute_aliases[key.to_s]
new_hash[new_key] = new_hash.delete(key)
end
end
new_hash
end
def arel_attribute(column_name)
if klass
klass.arel_attribute(column_name, arel_table)