Replace this line with Answer.new(text: params[:answer][:text], question_id: params[:answer][:question_id])