[RUBY] [No Method Error] Solution when new action occurs


I want to move to the registration screen, but I get an error and cannot display it at all: sob: As a result of falling into a situation and struggling for hours, it was resolved, so I will leave it as a memorandum.


I get the following error: zap: スクリーンショット 2020-05-29 11.45.21.png


Rails.application.routes.draw do
  devise_for :users
  root "groups#index"

  resources :users, only: [:edit, :update]

  resources :groups, only: [:index, :new, :create, :edit, :update] do
    resources :tasks, only: [:index, :new, :create, :edit, :update, :destroy]


  def new
    @task = Task.new


  = form_for @task do |f|

Impressions of seeing the error

Not strange: disappointed_relieved: What are you saying: persevere: There is no data because it is a new action. I was in agony alone. .. ..


The cause is [the path automatically generated by form_for is ** plural only **]! !! It was also mentioned in the error text!

undefind method 'tasks_path' for ~

What do I say when I read that passage? ?? There is no such pass: triumph: I thought: sweat:


I changed the view as below!


  = form_for @task, url: group_tasks_path do |f|


スクリーンショット 2020-05-29 13.40.42.png

I hope it will be a stepping stone for those who are worried about something similar: relaxed:



Recommended Posts

[No Method Error] Solution when new action occurs
[Rails] Solution when migration error occurs in acts-as-taggable-on
Rails <% = expression%> Why no error occurs when empty
No error message is displayed when create action fails
No static method getFont error
[Android] no such table error solution
Solution notes when an error occurs when downloading docker gpg using curl
A reminder when an aapt.exe error occurs
Solution when you get the error Webpacker :: Manifest :: MissingEntryError in Devise :: Sessions # new
Error in bundle install when running rails new
[Rails] "private method` String' called ~ "error when db: migrate
What to do when a null byte error occurs
Error ExecJS :: RuntimeUnavailable: What to do when it occurs
Solution for the error "no basic auth credentials" when pushing a Docker container to Heroku