aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/collection_association.rb
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2013-07-29 09:22:14 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2014-02-20 10:34:52 +0530
commit9694f86de65e9162a6802a43cdbce9ccc85285b5 (patch)
tree754cd6e873fadfb4a07f917744038bf830703dfe /activerecord/lib/active_record/associations/collection_association.rb
parent25ce856c3ea8beb864994b4b13df07b48574df9b (diff)
downloadrails-9694f86de65e9162a6802a43cdbce9ccc85285b5.tar.gz
rails-9694f86de65e9162a6802a43cdbce9ccc85285b5.tar.bz2
rails-9694f86de65e9162a6802a43cdbce9ccc85285b5.zip
[Active Record] Renamed private methods create_record and update_record
This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645
Diffstat (limited to 'activerecord/lib/active_record/associations/collection_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 03ca00fa70..b90c90c7c4 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -138,11 +138,11 @@ module ActiveRecord
end
def create(attributes = {}, &block)
- create_record(attributes, &block)
+ _create_record(attributes, &block)
end
def create!(attributes = {}, &block)
- create_record(attributes, true, &block)
+ _create_record(attributes, true, &block)
end
# Add +records+ to this association. Returns +self+ so method calls may
@@ -452,13 +452,13 @@ module ActiveRecord
persisted + memory
end
- def create_record(attributes, raise = false, &block)
+ def _create_record(attributes, raise = false, &block)
unless owner.persisted?
raise ActiveRecord::RecordNotSaved, "You cannot call create unless the parent is saved"
end
if attributes.is_a?(Array)
- attributes.collect { |attr| create_record(attr, raise, &block) }
+ attributes.collect { |attr| _create_record(attr, raise, &block) }
else
transaction do
add_to_target(build_record(attributes)) do |record|