Files
has_aux_table/spec/spec_models.rb
Dylan Knutson 8e1c193801 spec refactor
2025-07-18 05:51:24 +00:00

57 lines
955 B
Ruby

# typed: strict
# frozen_string_literal: true
class Vehicle < ActiveRecord::Base
include HasAuxTable
belongs_to :vehicle_lot
end
class VehicleLot < ActiveRecord::Base
has_many :vehicles
end
class Car < Vehicle
aux_table :car
has_many :drivers, inverse_of: :car
end
class Boat < Vehicle
aux_table :boat
has_many :passengers, inverse_of: :boat
belongs_to :captain, inverse_of: :boat
end
class Person < ActiveRecord::Base
include HasAuxTable
self.table_name = "people"
end
class Driver < Person
aux_table :driver
belongs_to :car, inverse_of: :drivers
end
class Captain < Person
aux_table :captain
has_one :boat, inverse_of: :captain
end
class Passenger < Person
aux_table :passenger
belongs_to :boat, inverse_of: :passengers
end
module Kitchen
class Utensil < ActiveRecord::Base
include HasAuxTable
end
class Fork < Utensil
aux_table :fork
end
class Spoon < Utensil
aux_table :spoon
end
end