foreman/app/models/image.rb @ 229d7436
dd42df0a | Ohad Levy | class Image < ActiveRecord::Base
|
|
229d7436 | Joseph Magen | ||
audited :allow_mass_assignment => true
|
|||
dd42df0a | Ohad Levy | belongs_to :operatingsystem
|
|
belongs_to :compute_resource
|
|||
belongs_to :architecture
|
|||
f2c78d4a | Joseph Magen | ||
3f77babd | Joseph Mitchell Magen | has_many_hosts
|
|
f2c78d4a | Joseph Magen | validates :username, :name, :operatingsystem_id, :compute_resource_id, :architecture_id, :presence => true
|
|
validates :uuid, :presence => true, :uniqueness => {:scope => :compute_resource_id}
|
|||
dd42df0a | Ohad Levy | ||
scoped_search :on => [:name, :username], :complete_value => true
|
|||
scoped_search :in => :compute_resources, :on => :name, :complete_value => :true, :rename => "compute_resource"
|
|||
scoped_search :in => :architecture, :on => :id, :rename => "architecture"
|
|||
scoped_search :in => :operatingsystem, :on => :id, :rename => "operatingsystem"
|
|||
end
|