diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-04 18:38:06 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-04 18:38:06 -0300 |
commit | e9e53415496dac22b65298f0eb1ba60725b3ecbb (patch) | |
tree | 9360e4659d4165858e76d94310e254171775823e /activerecord/lib/active_record/associations | |
parent | bc6a94902097b68482479acb49bdd03ba292a3e8 (diff) | |
parent | 9694f86de65e9162a6802a43cdbce9ccc85285b5 (diff) | |
download | rails-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.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/singular_association.rb | 6 |
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 |