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

Remove attributes_with_values_for_{create,update} for internal use

`attributes_with_values_for_update` is no longer used since ae2d36c, and
`attributes_with_values_for_create` is internally used only one place.
This commit is contained in:
Ryuta Kamizono 2018-08-30 23:42:33 +09:00
parent a72ac3cfec
commit 56ca81a911
2 changed files with 5 additions and 10 deletions

View file

@ -451,14 +451,6 @@ module ActiveRecord
defined?(@attributes) && @attributes.key?(attr_name)
end
def attributes_with_values_for_create(attribute_names)
attributes_with_values(attributes_for_create(attribute_names))
end
def attributes_with_values_for_update(attribute_names)
attributes_with_values(attributes_for_update(attribute_names))
end
def attributes_with_values(attribute_names)
attribute_names.each_with_object({}) do |name, attrs|
attrs[name] = _read_attribute(name)

View file

@ -738,9 +738,12 @@ module ActiveRecord
# and returns its id.
def _create_record(attribute_names = self.attribute_names)
attribute_names &= self.class.column_names
attributes_values = attributes_with_values_for_create(attribute_names)
attribute_names = attributes_for_create(attribute_names)
new_id = self.class._insert_record(
attributes_with_values(attribute_names)
)
new_id = self.class._insert_record(attributes_values)
self.id ||= new_id if self.class.primary_key
@new_record = false