ManageIQ/manageiq

View on GitHub
app/models/service_template_catalog.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
90%
class ServiceTemplateCatalog < ApplicationRecord
  include TenancyMixin
  validates :name, :presence => true, :uniqueness_when_changed => {:scope => :tenant_id}

  belongs_to :tenant
  has_many  :service_templates, :dependent => :nullify

  acts_as_miq_taggable

  def self.seed
    create!(:name => "My Catalog", :tenant => Tenant.root_tenant) unless any?
  end

  def self.display_name(number = 1)
    n_('Catalog', 'Catalogs', number)
  end
end