foreman/app/models/architecture.rb @ acfbc458
a393106d | Ohad Levy | class Architecture < ActiveRecord::Base
|
|
acfbc458 | Marek Hulan | include Authorizable
|
|
d7611b24 | Greg Sutcliffe | ||
ff8cc704 | Joseph Mitchell Magen | before_destroy EnsureNotUsedBy.new(:hosts, :hostgroups)
|
|
d7611b24 | Greg Sutcliffe | has_many_hosts
|
|
7d993b41 | Joseph Mitchell Magen | has_many :hostgroups
|
|
dd42df0a | Ohad Levy | has_many :images, :dependent => :destroy
|
|
e6d73c7f | Ohad Levy | has_and_belongs_to_many :operatingsystems
|
|
f2c78d4a | Joseph Magen | validates :name, :uniqueness => true, :format => { :with => /\A(\S+)\Z/, :message => N_("can't be blank or contain white spaces.") }
|
|
9c864cb6 | Ohad Levy | audited :allow_mass_assignment => true
|
|
a393106d | Ohad Levy | ||
8104eced | Ohad Levy | scoped_search :on => :name, :complete_value => :true
|
|
64e8d608 | Ohad Levy | def to_param
|
|
39558b72 | Dmitri Dolguikh | "#{id}-#{name.parameterize}"
|
|
64e8d608 | Ohad Levy | end
|
|
a393106d | Ohad Levy | end
|