summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issue_relations_controller.rb9
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|