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/test/models/ship_part.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/test/models/ship_part.rb')
-rw-r--r-- | activerecord/test/models/ship_part.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/ship_part.rb b/activerecord/test/models/ship_part.rb index b6a8a506b4..05c65f8a4a 100644 --- a/activerecord/test/models/ship_part.rb +++ b/activerecord/test/models/ship_part.rb @@ -2,6 +2,7 @@ class ShipPart < ActiveRecord::Base belongs_to :ship has_many :trinkets, :class_name => "Treasure", :as => :looter accepts_nested_attributes_for :trinkets, :allow_destroy => true + accepts_nested_attributes_for :ship validates_presence_of :name -end
\ No newline at end of file +end |