diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-02-14 01:02:42 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-02-14 01:40:31 +0000 |
commit | db03308451497dd6c7fa6e531b378f63f0781e7c (patch) | |
tree | fac2f342160972c0583dfb6a1bbf2dc230565d6e | |
parent | 641a3068ea11c20e09358d6911404a265da32a9f (diff) | |
download | rails-db03308451497dd6c7fa6e531b378f63f0781e7c.tar.gz rails-db03308451497dd6c7fa6e531b378f63f0781e7c.tar.bz2 rails-db03308451497dd6c7fa6e531b378f63f0781e7c.zip |
Rename add_record_to_target_with_callbacks to add_to_target
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index a850cf39cd..b8187b1c6a 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -59,7 +59,7 @@ module ActiveRecord if attributes.is_a?(Array) attributes.collect { |attr| build(attr, &block) } else - add_record_to_target_with_callbacks(build_record(attributes)) do |record| + add_to_target(build_record(attributes)) do |record| yield(record) if block_given? set_owner_attributes(record) end @@ -73,7 +73,7 @@ module ActiveRecord ensure_owner_is_persisted! transaction do - add_record_to_target_with_callbacks(build_record(attributes)) do |record| + add_to_target(build_record(attributes)) do |record| yield(record) if block_given? insert_record(record) end @@ -96,7 +96,7 @@ module ActiveRecord transaction do records.flatten.each do |record| raise_on_type_mismatch(record) - add_record_to_target_with_callbacks(record) do |r| + add_to_target(record) do |r| result &&= insert_record(record) unless @owner.new_record? end end @@ -351,7 +351,7 @@ module ActiveRecord target end - def add_record_to_target_with_callbacks(record) + def add_to_target(record) callback(:before_add, record) yield(record) if block_given? @target ||= [] unless loaded? diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 16023defe3..fc68d7254a 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -413,7 +413,7 @@ module ActiveRecord if target_record existing_record = target_record else - association.send(:add_record_to_target_with_callbacks, existing_record) + association.send(:add_to_target, existing_record) end end |