From b43214c533ae5942ec4b50c9f32e749b8ca5daae Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Tue, 20 Sep 2016 10:45:36 +0530 Subject: Add a uniqueness constraint to `MergeRequestsClosingIssues` --- app/models/merge_requests_closing_issues.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/merge_requests_closing_issues.rb') diff --git a/app/models/merge_requests_closing_issues.rb b/app/models/merge_requests_closing_issues.rb index 4f093fa27c5..cd49076002d 100644 --- a/app/models/merge_requests_closing_issues.rb +++ b/app/models/merge_requests_closing_issues.rb @@ -1,4 +1,9 @@ class MergeRequestsClosingIssues < ActiveRecord::Base belongs_to :merge_request belongs_to :issue + + validates_uniqueness_of :merge_request_id, scope: :issue_id + + validates_presence_of :merge_request + validates_presence_of :issue end -- cgit v1.2.1