##// END OF EJS Templates
Prevent creation of project with identifier 'new' (#3602)....
Jean-Philippe Lang -
r2716:36d8f3519246
parent child
Show More
@@ -63,7 +63,9 class Project < ActiveRecord::Base
63 63 validates_length_of :identifier, :in => 1..20
64 64 # donwcase letters, digits, dashes but not digits only
65 65 validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? }
66
66 # reserved words
67 validates_exclusion_of :identifier, :in => %w( new )
68
67 69 before_destroy :delete_all_members
68 70
69 71 named_scope :has_module, lambda { |mod| { :conditions => ["#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s] } }
@@ -52,7 +52,8 class ProjectTest < Test::Unit::TestCase
52 52 to_test = {"abc" => true,
53 53 "ab12" => true,
54 54 "ab-12" => true,
55 "12" => false}
55 "12" => false,
56 "new" => false}
56 57
57 58 to_test.each do |identifier, valid|
58 59 p = Project.new
General Comments 0
You need to be logged in to leave comments. Login now