Reputation: 11903
I have the following routes defined:
resources :employees do
resources :questions
member do
get :results
end
end
One of the routes (rake routes) for the above resources prints this:
new_employee_question GET /employees/:employee_id/questions/new(.:format) questions#new
But when I do this = link_to 'New Question', :new_employee_question
I get the following error:
No route matches {:action=>"new", :controller=>"questions"}
I have both QuestionsController
& EmployeesController
defined with the required action methods.
I also tried the following in rails console:
Rails.application.routes.recognize_path(app.new_employee_question_path)
...which generates the following error:
ActionController::RoutingError: No route matches {:controller=>"questions"}
I am using Rails 3.2.6
. Is there something I am doing wrong?
Upvotes: 1
Views: 659
Reputation: 13925
Try using this:
= link_to 'New Question', new_employee_question_path(@employee)
Upvotes: 1