Skip to content

Commit

Permalink
Add validation for the notification and project association
Browse files Browse the repository at this point in the history
The pair notification and project should be unique.
  • Loading branch information
saraycp committed Apr 27, 2020
1 parent f93352f commit c657fc5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/app/models/notified_project.rb
Expand Up @@ -4,4 +4,6 @@ class NotifiedProject < ApplicationRecord

validates :notification, presence: true
validates :project, presence: true

validates :notification_id, uniqueness: { scope: :project_id, message: 'These notification and project are already associated' }
end

0 comments on commit c657fc5

Please sign in to comment.