models: require belong_to associations on follow
This commit is contained in:
parent
91619b16e8
commit
aff2713032
2 changed files with 4 additions and 2 deletions
|
@ -14,8 +14,8 @@
|
||||||
# instructeur_id :integer not null
|
# instructeur_id :integer not null
|
||||||
#
|
#
|
||||||
class Follow < ApplicationRecord
|
class Follow < ApplicationRecord
|
||||||
belongs_to :instructeur
|
belongs_to :instructeur, optional: false
|
||||||
belongs_to :dossier
|
belongs_to :dossier, optional: false
|
||||||
|
|
||||||
validates :instructeur_id, uniqueness: { scope: [:dossier_id, :unfollowed_at] }
|
validates :instructeur_id, uniqueness: { scope: [:dossier_id, :unfollowed_at] }
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :follow do
|
factory :follow do
|
||||||
|
association :instructeur
|
||||||
|
association :dossier
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue