diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2021-08-11 20:35:28 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2021-08-11 20:35:28 +0000 |
commit | 24a8f97decffc6a3bec3e581d3b93937d0e40531 (patch) | |
tree | 871d5786a38049967c49c8365f6b180595edf39e /app | |
parent | 10b9620176253a654c4dc00526e40c6ad0d15778 (diff) | |
download | redmine-24a8f97decffc6a3bec3e581d3b93937d0e40531.tar.gz redmine-24a8f97decffc6a3bec3e581d3b93937d0e40531.zip |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/issue_relations_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
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| |