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