aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-04 18:38:06 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-04 18:38:06 -0300
commite9e53415496dac22b65298f0eb1ba60725b3ecbb (patch)
tree9360e4659d4165858e76d94310e254171775823e /activerecord/lib/active_record/associations
parentbc6a94902097b68482479acb49bdd03ba292a3e8 (diff)
parent9694f86de65e9162a6802a43cdbce9ccc85285b5 (diff)
downloadrails-e9e53415496dac22b65298f0eb1ba60725b3ecbb.tar.gz
rails-e9e53415496dac22b65298f0eb1ba60725b3ecbb.tar.bz2
rails-e9e53415496dac22b65298f0eb1ba60725b3ecbb.zip
Merge pull request #11650 from prathamesh-sonpatki/rename
Renamed private methods _create_record and _update_record
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb8
-rw-r--r--activerecord/lib/active_record/associations/singular_association.rb6
2 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 80ae38b3fb..dee7e972c1 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -134,11 +134,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
@@ -449,13 +449,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|
diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb
index 399aff378a..747bb5f1d6 100644
--- a/activerecord/lib/active_record/associations/singular_association.rb
+++ b/activerecord/lib/active_record/associations/singular_association.rb
@@ -18,11 +18,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
def build(attributes = {})
@@ -52,7 +52,7 @@ module ActiveRecord
replace(record)
end
- def create_record(attributes, raise_error = false)
+ def _create_record(attributes, raise_error = false)
record = build_record(attributes)
yield(record) if block_given?
saved = record.save