aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-08-30 23:42:33 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-08-30 23:42:33 +0900
commit56ca81a9111d1a47349299e2b973160885bad767 (patch)
tree00e282e5af4809b4ab028dabd061a155e24159ef /activerecord
parenta72ac3cfec9956ccf093d870705d3dc22ced090e (diff)
downloadrails-56ca81a9111d1a47349299e2b973160885bad767.tar.gz
rails-56ca81a9111d1a47349299e2b973160885bad767.tar.bz2
rails-56ca81a9111d1a47349299e2b973160885bad767.zip
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.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb8
-rw-r--r--activerecord/lib/active_record/persistence.rb7
2 files changed, 5 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 1d18119c66..f657a74595 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -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)
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 05963e5546..215b59f182 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -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