After adding a helper method and edit my form, I\'m getting this error
TypeError in Posts#create Showing /Users/jim/project/test/app/views/posts/_form.html.erb
I have found the problem thanks to @sissy comment.
I should pass @question = cookies[:question] instead of @question = Question.where(id: params[:post][:question_id]).first in my create action of my posts controller
@question = cookies[:question]
@question = Question.where(id: params[:post][:question_id]).first
create
posts controller
Thanks everyone for your help.