##// END OF EJS Templates
Merged r15989 and r15991 (#24283)....
Jean-Philippe Lang -
r15621:308133be4532
parent child
Show More
@@ -31,6 +31,7 class CustomField < ActiveRecord::Base
31 validates_presence_of :name, :field_format
31 validates_presence_of :name, :field_format
32 validates_uniqueness_of :name, :scope => :type
32 validates_uniqueness_of :name, :scope => :type
33 validates_length_of :name, :maximum => 30
33 validates_length_of :name, :maximum => 30
34 validates_length_of :regexp, maximum: 30
34 validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
35 validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
35 validate :validate_custom_field
36 validate :validate_custom_field
36 attr_protected :id
37 attr_protected :id
@@ -37,7 +37,9 class Repository < ActiveRecord::Base
37 # has_many :changesets, :dependent => :destroy is too slow for big repositories
37 # has_many :changesets, :dependent => :destroy is too slow for big repositories
38 before_destroy :clear_changesets
38 before_destroy :clear_changesets
39
39
40 validates_length_of :login, maximum: 60, allow_nil: true
40 validates_length_of :password, :maximum => 255, :allow_nil => true
41 validates_length_of :password, :maximum => 255, :allow_nil => true
42 validates_length_of :root_url, :url, maximum: 255
41 validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
43 validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
42 validates_uniqueness_of :identifier, :scope => :project_id
44 validates_uniqueness_of :identifier, :scope => :project_id
43 validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision)
45 validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision)
@@ -111,6 +111,7 class User < Principal
111 validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
111 validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
112 validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
112 validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
113 validates_length_of :firstname, :lastname, :maximum => 30
113 validates_length_of :firstname, :lastname, :maximum => 30
114 validates_length_of :identity_url, maximum: 255
114 validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
115 validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
115 validate :validate_password_length
116 validate :validate_password_length
116 validate do
117 validate do
@@ -34,7 +34,7 class Version < ActiveRecord::Base
34 validates_presence_of :name
34 validates_presence_of :name
35 validates_uniqueness_of :name, :scope => [:project_id]
35 validates_uniqueness_of :name, :scope => [:project_id]
36 validates_length_of :name, :maximum => 60
36 validates_length_of :name, :maximum => 60
37 validates_length_of :description, :maximum => 255
37 validates_length_of :description, :wiki_page_title, :maximum => 255
38 validates :effective_date, :date => true
38 validates :effective_date, :date => true
39 validates_inclusion_of :status, :in => VERSION_STATUSES
39 validates_inclusion_of :status, :in => VERSION_STATUSES
40 validates_inclusion_of :sharing, :in => VERSION_SHARINGS
40 validates_inclusion_of :sharing, :in => VERSION_SHARINGS
@@ -25,6 +25,7 class Wiki < ActiveRecord::Base
25
25
26 validates_presence_of :start_page
26 validates_presence_of :start_page
27 validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/
27 validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/
28 validates_length_of :start_page, maximum: 255
28 attr_protected :id
29 attr_protected :id
29
30
30 before_destroy :delete_redirects
31 before_destroy :delete_redirects
@@ -45,6 +45,7 class WikiPage < ActiveRecord::Base
45 validates_presence_of :title
45 validates_presence_of :title
46 validates_format_of :title, :with => /\A[^,\.\/\?\;\|\s]*\z/
46 validates_format_of :title, :with => /\A[^,\.\/\?\;\|\s]*\z/
47 validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
47 validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
48 validates_length_of :title, maximum: 255
48 validates_associated :content
49 validates_associated :content
49 attr_protected :id
50 attr_protected :id
50
51
General Comments 0
You need to be logged in to leave comments. Login now