As rake routes gives the exact route I visited, the page shows
Routing Error uninitialized constant TasksController Did you mean? AppsController
In routes.rb I wrote
resources :users do
resources :tasks do
collection do
post 'tasks-info', to: 'users/tasks#tasks_info', format: 'json'
end
end
end
And the tasks_controller.rb is under app/controllers/users folder
def show
end
show.html.slim is under app/views/users/tasks foler
The url I visited is http://localhost:3000/users/1/tasks/1 with rake routes includinguser_task_path GET /users/:user_id/tasks/:id(.:format) tasks#show
I really don't know where the error comes from, any help is truly appreciated!
Updated: Problem solved and please refer to the comments below if you have the same issue here(I have summarized based on my own understanding, not sure whether it's exactly correct though)! Or see the answers below as engineersmnky's and Scott's answers should both work.
TasksControllerin the appropriate namespace? Its not just the file location (afaik), but also the content of the file needs to be in theUsersnamespace. Please try that and get back.class Users::TasksController < ApplicationController