##// END OF EJS Templates
Added several validates_length_of...
Jean-Philippe Lang -
r590:fcefdb22bfc3
parent child
Show More
@@ -22,7 +22,9 class Attachment < ActiveRecord::Base
22 22 belongs_to :author, :class_name => "User", :foreign_key => "author_id"
23 23
24 24 validates_presence_of :container, :filename
25
25 validates_length_of :filename, :maximum => 255
26 validates_length_of :disk_filename, :maximum => 255
27
26 28 cattr_accessor :storage_path
27 29 @@storage_path = "#{RAILS_ROOT}/files"
28 30
@@ -29,6 +29,7 class CustomField < ActiveRecord::Base
29 29
30 30 validates_presence_of :name, :field_format
31 31 validates_uniqueness_of :name
32 validates_length_of :name, :maximum => 30
32 33 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
33 34 validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
34 35
@@ -21,4 +21,5 class Document < ActiveRecord::Base
21 21 has_many :attachments, :as => :container, :dependent => :destroy
22 22
23 23 validates_presence_of :project, :title, :category
24 validates_length_of :title, :maximum => 60
24 25 end
@@ -20,6 +20,7 class Enumeration < ActiveRecord::Base
20 20
21 21 validates_presence_of :opt, :name
22 22 validates_uniqueness_of :name, :scope => [:opt]
23 validates_length_of :name, :maximum => 30
23 24 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
24 25
25 26 OPTIONS = {
@@ -38,6 +38,7 class Issue < ActiveRecord::Base
38 38 acts_as_watchable
39 39
40 40 validates_presence_of :subject, :description, :priority, :tracker, :author, :status
41 validates_length_of :subject, :maximum => 255
41 42 validates_inclusion_of :done_ratio, :in => 0..100
42 43 validates_associated :custom_values, :on => :update
43 44
@@ -22,6 +22,7 class IssueStatus < ActiveRecord::Base
22 22
23 23 validates_presence_of :name
24 24 validates_uniqueness_of :name
25 validates_length_of :name, :maximum => 30
25 26 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
26 27 validates_length_of :html_color, :is => 6
27 28 validates_format_of :html_color, :with => /^[a-f0-9]*$/i
@@ -21,6 +21,8 class News < ActiveRecord::Base
21 21 has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
22 22
23 23 validates_presence_of :title, :description
24 validates_length_of :title, :maximum => 60
25 validates_length_of :summary, :maximum => 255
24 26
25 27 # returns latest news for projects visible by user
26 28 def self.latest(user=nil, count=5)
@@ -24,6 +24,7 class Query < ActiveRecord::Base
24 24 attr_accessor :executed_by
25 25
26 26 validates_presence_of :name, :on => :save
27 validates_length_of :name, :maximum => 255
27 28
28 29 @@operators = { "=" => :label_equals,
29 30 "!" => :label_not_equals,
@@ -24,6 +24,7 class Role < ActiveRecord::Base
24 24
25 25 validates_presence_of :name
26 26 validates_uniqueness_of :name
27 validates_length_of :name, :maximum => 30
27 28 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
28 29
29 30 def <=>(role)
@@ -24,6 +24,7 class Tracker < ActiveRecord::Base
24 24
25 25 validates_presence_of :name
26 26 validates_uniqueness_of :name
27 validates_length_of :name, :maximum => 30
27 28 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
28 29
29 30 private
@@ -23,6 +23,7 class Version < ActiveRecord::Base
23 23
24 24 validates_presence_of :name
25 25 validates_uniqueness_of :name, :scope => [:project_id]
26 validates_length_of :name, :maximum => 30
26 27 validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date, :allow_nil => true
27 28
28 29 def start_date
General Comments 0
You need to be logged in to leave comments. Login now