rails/activerecord/test/models/ship_part.rb
Sean Griffin 85465ed3e6 Always perform validations on nested attribute associations
Collection associations would have already been validated, but singular
associations were not.

Fixes #18735.
2015-01-30 07:27:20 -07:00

9 lines
258 B
Ruby

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