aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/nested_attributes.rb
diff options
context:
space:
mode:
authorAlireza Bashiri <azbshiri@gmail.com>2018-07-27 11:20:45 +0430
committerAlireza Bashiri <azbshiri@gmail.com>2018-08-02 08:27:03 +0430
commitdc16cdd89a93817203e7c8a49af174fde81402e0 (patch)
tree249f5b7b45cabe0aed07046f21373acc58d397c5 /activerecord/lib/active_record/nested_attributes.rb
parent67fa1ad0c3b811aa527ec748e14d95dee2db9f69 (diff)
downloadrails-dc16cdd89a93817203e7c8a49af174fde81402e0.tar.gz
rails-dc16cdd89a93817203e7c8a49af174fde81402e0.tar.bz2
rails-dc16cdd89a93817203e7c8a49af174fde81402e0.zip
Call build when extend with nested attributes defined
What? From now on when `accepts_nested_attributes_for` defined and `extend` option added the overwritten `build` method being called. [Alireza Bashiri, Martins Polakovs]
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r--activerecord/lib/active_record/nested_attributes.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb
index fa20bce3a9..50767ee93f 100644
--- a/activerecord/lib/active_record/nested_attributes.rb
+++ b/activerecord/lib/active_record/nested_attributes.rb
@@ -501,7 +501,7 @@ module ActiveRecord
if attributes["id"].blank?
unless reject_new_record?(association_name, attributes)
- association.build(attributes.except(*UNASSIGNABLE_KEYS))
+ association.reader.build(attributes.except(*UNASSIGNABLE_KEYS))
end
elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes["id"].to_s }
unless call_reject_if(association_name, attributes)