models: require belong_to associations on feedback

This commit is contained in:
Pierre de La Morinerie 2020-07-20 16:44:40 +02:00
parent 79fcf5e814
commit 91619b16e8
2 changed files with 2 additions and 1 deletions

View file

@ -9,7 +9,7 @@
# user_id :bigint
#
class Feedback < ApplicationRecord
belongs_to :user
belongs_to :user, optional: false
enum rating: {
happy: 'happy',

View file

@ -1,6 +1,7 @@
FactoryBot.define do
factory :feedback do
rating { Feedback.ratings.fetch(:happy) }
association :user
trait :happy do
rating { Feedback.ratings.fetch(:happy) }