##// END OF EJS Templates
Skip some validations if attribute did not change....
Jean-Philippe Lang -
r13341:e09f48e45994
parent child
Show More
@@ -66,7 +66,10 class Issue < ActiveRecord::Base
66 66 attr_reader :current_journal
67 67 delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true
68 68
69 validates_presence_of :subject, :priority, :project, :tracker, :author, :status
69 validates_presence_of :subject, :project, :tracker
70 validates_presence_of :priority, :if => Proc.new {|issue| issue.new_record? || issue.priority_id_changed?}
71 validates_presence_of :status, :if => Proc.new {|issue| issue.new_record? || issue.status_id_changed?}
72 validates_presence_of :author, :if => Proc.new {|issue| issue.new_record? || issue.author_id_changed?}
70 73
71 74 validates_length_of :subject, :maximum => 255
72 75 validates_inclusion_of :done_ratio, :in => 0..100
@@ -72,8 +72,7 class Project < ActiveRecord::Base
72 72 attr_protected :status
73 73
74 74 validates_presence_of :name, :identifier
75 validates_uniqueness_of :identifier
76 validates_associated :repository, :wiki
75 validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}
77 76 validates_length_of :name, :maximum => 255
78 77 validates_length_of :homepage, :maximum => 255
79 78 validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
General Comments 0
You need to be logged in to leave comments. Login now