Question: user association is optional
This commit is contained in:
parent
07f489430c
commit
dd5f718f31
|
@ -1,7 +1,7 @@
|
|||
class Question < ApplicationRecord
|
||||
include Question::AnswerMethods
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :user, optional: true
|
||||
has_many :answers, dependent: :destroy
|
||||
has_many :inboxes, dependent: :destroy
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ describe Ajax::AnswerController, type: :controller do
|
|||
|
||||
describe "#destroy" do
|
||||
let(:answer_user) { user }
|
||||
let(:question) { FactoryBot.create(:question, user: FactoryBot.create(:user)) }
|
||||
let(:question) { FactoryBot.create(:question) }
|
||||
let(:answer) { FactoryBot.create(:answer, user: answer_user, question: question) }
|
||||
let(:answer_id) { answer.id }
|
||||
|
||||
|
|
Loading…
Reference in New Issue