Skip to content

Commit

Permalink
873038 - Entering an env name of "Library" when creating an
Browse files Browse the repository at this point in the history
organization does not give clear error message
  • Loading branch information
komidore64 committed Nov 19, 2012
1 parent 7db94a3 commit 6a07d19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/models/kt_environment.rb
Expand Up @@ -92,8 +92,10 @@ def <<(*items)

scope :completer_scope, lambda { |options| where('organization_id = ?', options[:organization_id])}

validates_uniqueness_of :name, :scope => :organization_id, :message => N_("must be unique within one organization")
validates_uniqueness_of :label, :scope => :organization_id, :message => N_("must be unique within one organization")
validates :name, :exclusion => { :in => ["Library"], :message => N_(": '%s' is a built-in environment") % "Library" }, :unless => :library?
validates :label, :exclusion => { :in => ["Library"], :message => N_(": '%s' is a built-in environment") % "Library" }, :unless => :library?
validates_uniqueness_of :name, :scope => :organization_id, :message => N_("of environment must be unique within one organization")
validates_uniqueness_of :label, :scope => :organization_id, :message => N_("of environment must be unique within one organization")
validates_presence_of :organization
validates :name, :presence => true, :katello_name_format => true
validates :label, :presence => true, :katello_label_format => true
Expand Down

0 comments on commit 6a07d19

Please sign in to comment.