aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-08-30 21:47:43 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-08-30 22:43:26 +0900
commita72ac3cfec9956ccf093d870705d3dc22ced090e (patch)
treed20d735d93f302d85fa70f27b36accdbcd5a4bc1 /activerecord
parent9297af5daf57c4dca7120a2979ba1923eb4e2a09 (diff)
downloadrails-a72ac3cfec9956ccf093d870705d3dc22ced090e.tar.gz
rails-a72ac3cfec9956ccf093d870705d3dc22ced090e.tar.bz2
rails-a72ac3cfec9956ccf093d870705d3dc22ced090e.zip
Remove extra `& self.class.column_names` in `keys_for_partial_write`
It should be done only once in `Persistence` module. https://github.com/rails/rails/blob/c83e30da27eafde79164ecb376e8a28ccc8d841f/activerecord/lib/active_record/persistence.rb#L721 https://github.com/rails/rails/blob/c83e30da27eafde79164ecb376e8a28ccc8d841f/activerecord/lib/active_record/persistence.rb#L740
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index bc25837fab..ebc2252c50 100644
--- a/activerecord/lib/active_record/attribute_methods/dirty.rb
+++ b/activerecord/lib/active_record/attribute_methods/dirty.rb
@@ -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