models: require belong_to associations on follow

This commit is contained in:
Pierre de La Morinerie 2020-07-20 14:46:26 +00:00
parent 91619b16e8
commit aff2713032
2 changed files with 4 additions and 2 deletions

View file

@ -14,8 +14,8 @@
# instructeur_id :integer not null
#
class Follow < ApplicationRecord
belongs_to :instructeur
belongs_to :dossier
belongs_to :instructeur, optional: false
belongs_to :dossier, optional: false
validates :instructeur_id, uniqueness: { scope: [:dossier_id, :unfollowed_at] }

View file

@ -1,4 +1,6 @@
FactoryBot.define do
factory :follow do
association :instructeur
association :dossier
end
end