summaryrefslogtreecommitdiffstats
path: root/app/controllers/issue_relations_controller.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-01-07 00:37:16 +0000
committerGo MAEDA <maeda@farend.jp>2018-01-07 00:37:16 +0000
commitec53586af369c08871b86032b3b4b02ca6c5d7f6 (patch)
tree79119aa34ac6b7d7c013c438cdf488c22966ca86 /app/controllers/issue_relations_controller.rb
parent85ea5ed02483f19c3a6f5fba8bf7d90e56a9bbd8 (diff)
downloadredmine-ec53586af369c08871b86032b3b4b02ca6c5d7f6.tar.gz
redmine-ec53586af369c08871b86032b3b4b02ca6c5d7f6.zip
Handle validation errors on reverse issue relations (#27695).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@17141 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/issue_relations_controller.rb')
-rw-r--r--app/controllers/issue_relations_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb
index abdd60d7c..0bcc8c5e3 100644
--- a/app/controllers/issue_relations_controller.rb
+++ b/app/controllers/issue_relations_controller.rb
@@ -46,7 +46,13 @@ class IssueRelationsController < ApplicationController
@relation.issue_from = @issue
@relation.safe_attributes = params[:relation]
@relation.init_journals(User.current)
- saved = @relation.save
+
+ begin
+ saved = @relation.save
+ rescue ActiveRecord::RecordNotUnique
+ saved = false
+ @relation.errors.add :base, :taken
+ end
respond_to do |format|
format.html { redirect_to issue_path(@issue) }