diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 08:15:36 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 10:53:14 +0300 |
commit | b43214c533ae5942ec4b50c9f32e749b8ca5daae (patch) | |
tree | 3fbd6a3d96a3b07015c5a893ac529ea65ef83821 | |
parent | 204419e9e9b01977cbeac34b1a8385239b1455aa (diff) |
Add a uniqueness constraint to `MergeRequestsClosingIssues`
-rw-r--r-- | app/models/merge_requests_closing_issues.rb | 5 |
1 files changed, 5 insertions, 0 deletions
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 |