Sha256: 197ed052833dafb96d216121dd4ffa0a1b59271303a8b4244969dd5acaac5e50

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# This models the partition tables for a disk layouts
# It supports both static partition maps and dynamic scripts that create partition tables on-the-fly
# A host object may contain a reference to one of these ptables or, alternatively, it may contain a
# modified version of one of these in textual form
class Ptable < ActiveRecord::Base
  include Authorization

  has_many_hosts
  has_and_belongs_to_many :operatingsystems
  before_destroy EnsureNotUsedBy.new(:hosts)
  validates_uniqueness_of :name
  validates_presence_of :layout
  validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => N_("can't be blank or contain trailing white spaces.")
  default_scope :order => 'LOWER(ptables.name)'

  scoped_search :on => :name, :complete_value => true, :default_order => true
  scoped_search :on => :layout, :complete_value => false
  scoped_search :on => :os_family, :rename => "family", :complete_value => :true

  def as_json(options={})
    options ||= {}
    super({:only => [:name, :id]}.merge(options))
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/ptable.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/ptable.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/ptable.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/ptable.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/ptable.rb