Added some attributes length validations.
Also added some information about attribute length constraints on forms. git-svn-id: http://redmine.rubyforge.org/svn/trunk@400 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -35,8 +35,10 @@ class Project < ActiveRecord::Base
|
||||
validates_uniqueness_of :name, :identifier
|
||||
validates_associated :custom_values, :on => :update
|
||||
validates_associated :repository, :wiki
|
||||
validates_length_of :name, :maximum => 30
|
||||
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
|
||||
validates_length_of :identifier, :maximum => 12
|
||||
validates_length_of :description, :maximum => 255
|
||||
validates_length_of :identifier, :in => 3..12
|
||||
validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
|
||||
|
||||
def identifier=(identifier)
|
||||
|
||||
+4
-1
@@ -33,9 +33,12 @@ class User < ActiveRecord::Base
|
||||
validates_presence_of :login, :firstname, :lastname, :mail
|
||||
validates_uniqueness_of :login, :mail
|
||||
# Login must contain lettres, numbers, underscores only
|
||||
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
|
||||
validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
|
||||
validates_length_of :login, :maximum => 30
|
||||
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
|
||||
validates_length_of :firstname, :lastname, :maximum => 30
|
||||
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||
validates_length_of :mail, :maximum => 60
|
||||
# Password length between 4 and 12
|
||||
validates_length_of :password, :in => 4..12, :allow_nil => true
|
||||
validates_confirmation_of :password, :allow_nil => true
|
||||
|
||||
Reference in New Issue
Block a user