diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-30 07:26:33 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-30 07:27:20 -0700 |
commit | 85465ed3e6c582d25f0c8fafe21f7a2c182c2f67 (patch) | |
tree | 4a81ee31eb66c298d0c0e85f19756b1114aec1a7 /activerecord/lib/active_record/nested_attributes.rb | |
parent | 5170c11c97c5e3e786530d0ce1719e38e3c09d1f (diff) | |
download | rails-85465ed3e6c582d25f0c8fafe21f7a2c182c2f67.tar.gz rails-85465ed3e6c582d25f0c8fafe21f7a2c182c2f67.tar.bz2 rails-85465ed3e6c582d25f0c8fafe21f7a2c182c2f67.zip |
Always perform validations on nested attribute associations
Collection associations would have already been validated, but singular
associations were not.
Fixes #18735.
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 919bbfa649..117a128579 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -312,6 +312,7 @@ module ActiveRecord attr_names.each do |association_name| if reflection = _reflect_on_association(association_name) reflection.autosave = true + define_autosave_validation_callbacks(reflection) nested_attributes_options = self.nested_attributes_options.dup nested_attributes_options[association_name.to_sym] = options |