@@ -41,6 +41,8 class IssueRelation < ActiveRecord::Base | |||
|
41 | 41 | validates_numericality_of :delay, :allow_nil => true |
|
42 | 42 | validates_uniqueness_of :issue_to_id, :scope => :issue_from_id |
|
43 | 43 | |
|
44 | validate :validate_issue_relation | |
|
45 | ||
|
44 | 46 | attr_protected :issue_from_id, :issue_to_id |
|
45 | 47 | |
|
46 | 48 | def visible?(user=User.current) |
@@ -61,7 +63,7 class IssueRelation < ActiveRecord::Base | |||
|
61 | 63 | end |
|
62 | 64 | end |
|
63 | 65 | |
|
64 | def validate | |
|
66 | def validate_issue_relation | |
|
65 | 67 | if issue_from && issue_to |
|
66 | 68 | errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id |
|
67 | 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