From 24a8f97decffc6a3bec3e581d3b93937d0e40531 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Wed, 11 Aug 2021 20:35:28 +0000 Subject: Merged r21150 to 4.2-stable (#35655). git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@21153 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issue_relations_controller.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index 52be512f1..8143f4f4a 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -56,10 +56,13 @@ class IssueRelationsController < ApplicationController @relation.safe_attributes = params_relation @relation.init_journals(User.current) - unless saved = @relation.save - saved = false - unsaved_relations << @relation + begin + saved = @relation.save + rescue ActiveRecord::RecordNotUnique + @relation.errors.add :base, :taken end + + unsaved_relations << @relation unless saved end respond_to do |format| -- cgit v1.2.3