Set a default value for relation type.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6177 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-04 17:29:33 +00:00
parent 21b3718744
commit ea06b3cca5
2 changed files with 17 additions and 3 deletions
+10 -2
View File
@@ -1,5 +1,5 @@
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
# Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -43,6 +43,14 @@ class IssueRelation < ActiveRecord::Base
attr_protected :issue_from_id, :issue_to_id
def after_initialize
if new_record?
if relation_type.blank?
self.relation_type = IssueRelation::TYPE_RELATES
end
end
end
def validate
if issue_from && issue_to
errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id