##// END OF EJS Templates
Rails3: replace deprecated 'validate' method at IssueRelation model....
Toshi MARUYAMA -
r6817:86d6f2fe372e
parent child
Show More
@@ -41,6 +41,8 class IssueRelation < ActiveRecord::Base
41 validates_numericality_of :delay, :allow_nil => true
41 validates_numericality_of :delay, :allow_nil => true
42 validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
42 validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
43
43
44 validate :validate_issue_relation
45
44 attr_protected :issue_from_id, :issue_to_id
46 attr_protected :issue_from_id, :issue_to_id
45
47
46 def visible?(user=User.current)
48 def visible?(user=User.current)
@@ -61,7 +63,7 class IssueRelation < ActiveRecord::Base
61 end
63 end
62 end
64 end
63
65
64 def validate
66 def validate_issue_relation
65 if issue_from && issue_to
67 if issue_from && issue_to
66 errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id
68 errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id
67 errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations?
69 errors.add :issue_to_id, :not_same_project unless issue_from.project_id == issue_to.project_id || Setting.cross_project_issue_relations?
General Comments 0
You need to be logged in to leave comments. Login now