ArgumentError in class#create while applying Ajax.

For these type of errors you must hav not initialized the vairiable with new keyword causing it to make a empty class.
<%@answer=Answer.new%> <%= form_for @answer, remote: true do |f|%> <%= f.text_area :content ,placeholder: "Write your answer", :class => 'a2', required: true%> <br> <%= f.hidden_field :question_id , :value => question.id %> <%= f.submit value:"Answer" ,:class => 'button1' ,id: 'create_answer_submit'%> <%end%> <br>
So the line @answer = Answer.new will save you.
or in other case like <%@answer_feed=Answer.all.order(created_at: :desc)%>.
Just for example purpose.
And do take while rendering , do check that the partial file is in home or in someother folder
Hope it helps

Leave a comment