Sha256: 2683b52aa1c32dc9a364964c6b9ab2cc03aedf1e26f824c51a5a4ef19220b3cd
Contents?: true
Size: 904 Bytes
Versions: 189
Compression:
Stored size: 904 Bytes
Contents
module Katello class HostCollectionHosts < Katello::Model belongs_to :host, :inverse_of => :host_collection_hosts, :class_name => 'Host::Managed' belongs_to :host_collection, :inverse_of => :host_collection_hosts, :class_name => "Katello::HostCollection" validate :validate_max_hosts_not_exceeded def validate_max_hosts_not_exceeded if new_record? && self.host_collection_id host_collection = HostCollection.find(self.host_collection_id) if host_collection && !host_collection.unlimited_hosts && (host_collection.hosts.size >= host_collection.max_hosts) errors.add :base, _("You cannot have more than %{max_hosts} host(s) associated with host collection '%{host_collection}'.") % { :max_hosts => host_collection.max_hosts, :host_collection => host_collection.name } end end end end end
Version data entries
189 entries across 189 versions & 1 rubygems