foreman/app/models/architecture.rb @ 783fb4aa
a393106d | Ohad Levy | class Architecture < ActiveRecord::Base
|
|
acfbc458 | Marek Hulan | include Authorizable
|
|
8b737c9c | Joseph Magen | extend FriendlyId
|
|
friendly_id :name
|
|||
e768c976 | Tomas Strachota | include Parameterizable::ByIdName
|
|
d7611b24 | Greg Sutcliffe | ||
ff8cc704 | Joseph Mitchell Magen | before_destroy EnsureNotUsedBy.new(:hosts, :hostgroups)
|
|
3034e8e2 | Ori Rabin | validates_lengths_from_database
|
|
ff8cc704 | Joseph Mitchell Magen | ||
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
|
|
dff926cb | Tomer Brisker | validates :name, :presence => true, :uniqueness => true, :no_whitespace => true
|
|
09f31315 | Tomer Brisker | audited :allow_mass_assignment => true, :except => [:hosts_count, :hostgroups_count]
|
|
a393106d | Ohad Levy | ||
8104eced | Ohad Levy | scoped_search :on => :name, :complete_value => :true
|
|
6895854c | Stephen Benjamin | scoped_search :on => :hosts_count
|
|
a393106d | Ohad Levy | end
|