summaryrefslogtreecommitdiffstats
path: root/app/models/issue_relation.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-04 17:29:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-04 17:29:33 +0000
commitea06b3cca5070dc5033de13e79e2dcf6f4cce2c1 (patch)
treebfd0c41c019b53aedda36768058f7d668c8ff790 /app/models/issue_relation.rb
parent21b37187445f03c9395f5fc36b5bd1a42d99d980 (diff)
downloadredmine-ea06b3cca5070dc5033de13e79e2dcf6f4cce2c1.tar.gz
redmine-ea06b3cca5070dc5033de13e79e2dcf6f4cce2c1.zip
Set a default value for relation type.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6177 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_relation.rb')
-rw-r--r--app/models/issue_relation.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb
index 751ac3579..c66103c51 100644
--- a/app/models/issue_relation.rb
+++ b/app/models/issue_relation.rb
@@ -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