aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/ship_part.rb
blob: 67c089a7d080da3268f3790ffff190a45f56632a (plain) (blame)
1
2
3
4
5
6
7
8
9
# frozen_string_literal: true
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