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

Remove extra & self.class.column_names in keys_for_partial_write

It should be done only once in `Persistence` module.

c83e30da27/activerecord/lib/active_record/persistence.rb (L721)
c83e30da27/activerecord/lib/active_record/persistence.rb (L740)
This commit is contained in:
Ryuta Kamizono 2018-08-30 21:47:43 +09:00
parent 9297af5daf
commit a72ac3cfec

View file

@ -164,20 +164,20 @@ module ActiveRecord
result
end
def _update_record(*)
affected_rows = partial_writes? ? super(keys_for_partial_write) : super
def _update_record(attribute_names = attribute_names_for_partial_writes)
affected_rows = super
changes_applied
affected_rows
end
def _create_record(*)
id = partial_writes? ? super(keys_for_partial_write) : super
def _create_record(attribute_names = attribute_names_for_partial_writes)
id = super
changes_applied
id
end
def keys_for_partial_write
changed_attribute_names_to_save & self.class.column_names
def attribute_names_for_partial_writes
partial_writes? ? changed_attribute_names_to_save : attribute_names
end
end
end