8
9
10
11
12
13
14
15
16
17
|
# File 'app/models/katello/host_collection_hosts.rb', line 8
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
|