I am making a three-choice quiz app with rails.
I want to create a quiz and a correct answer through a form, but I am having trouble solving the following error.
First question/programming I would appreciate if you could point out if there is something that i am new to scholarship.

There is an undefined method `text ', but I'm having trouble understanding the text method by looking at the controller file and view file. Is the wrong thing to look for as the cause of the error in the first place?

Error message
NoMethodError in QuestionsController # create
undefined method `text 'for #<Question: 0x00007f725807a838>Did you mean? test
Extracted source (around line # 11):
10 def create
11 Question.create (create_params)
12 redirect_to: root and return
Applicable source code
  def new
    @question = Question.new
  def create
    Question.create (create_params)
    redirect_to: root and return
  def create_params
    params.require (: question) .permit (: questions,: title,: choice1,: choice2,: choice3,: correct) .merge (user_id: current_user.id)
new.html.erb (view file)
<% = form_for (@question) do | f |%>
       Quiz title<br>
      <% = f.text_area: title,: size =>"60x1", placeholder: "Example: rails command"%><br>
      <% = f.text_area: questions,: size =>"60x5", placeholder: "Example: What is the command to start the server?"%><br>
     Option A<br>
      <% = f.text_area: choice1,: size =>"60x1", placeholder: "Example: rails routes"%><br>
     Option B<br>
      <% = f.text_area: choice2,: size =>"60x1", placeholder: "Example: rails g"%><br>
     Option C<br>
      <% = f.text_area: choice3,: size =>"60x1", placeholder: "Example: rails s"%><br>
     Correct answer<br>
      <% = f.text_area: correct,: size =>"60x1", placeholder: "Example: rails s"%><br>
      <% = f.submit "create a problem"%>
What I tried

I checked the contents of Request, but it seemed that there was no problem because the contents defined in create_params were sent to/questions by POST. Below contents of Request Parameters:

{"utf8" =>"✓",  "authenticity_token" =>"P7oA7C56XXWaYcZpeJBp8JDvokom1balNWtNfqrW + YvNKJURosJ9GSqbH0BgE4Fvf + 7NA3eqObMCV9o5csFn1A ==",  "question" =>{"title" =>"a", "questions" =>"s", "choice1" =>"a", "choice2" =>"s", "choice3" =>"d" , "correct" =>"a"},  "commit" =>"create a problem"}

I also checked the code because it was undefined method `text 'for #Did you mean? Test. There was f.text_area of ​​form_for that text used characters, but I used test_area several times before, but there was no problem. I felt that the request made as above was not strange.
Did you mean? Test, but there is a question about where the test came from.

Supplemental information (FW/tool version, etc.)

ruby 2.5.1p57

I'm afraid there are some points that I can't reach, but I would like to ask for your kind support.

  • Answer # 1

    We recommend that you check the model's validate and association.

    Rails trace display is
    Since it is the default (Application Trace) to display only the code written by the developer without displaying the library code
    The location may be different from the actual error cause.

    If you can't pinpoint the problem with Application Trace, you should also check Full Trace.