mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
17 lines
529 B
Ruby
17 lines
529 B
Ruby
class Machine < ActiveRecord::Base
|
|
extend FriendlyId
|
|
friendly_id :name, use: :slugged
|
|
|
|
has_one :machine_image, as: :viewable, dependent: :destroy
|
|
accepts_nested_attributes_for :machine_image, allow_destroy: true
|
|
|
|
has_many :machine_files, as: :viewable, dependent: :destroy
|
|
accepts_nested_attributes_for :machine_files, allow_destroy: true
|
|
|
|
has_and_belongs_to_many :projects, join_table: 'projects_machines'
|
|
|
|
validates :name, presence: true, length: { maximum: 50 }
|
|
validates :description, presence: true
|
|
|
|
end
|