Reputation: 1011
I'm trying to get the url for given params:
url_for({
:action => "show",
:controller => "questions",
:dashboard_id => "123",
:dashboard_type => "mono",
:question_id => "1234",
:only_path => true
})
But I get this error:
ActionController::RoutingError: No route matches {:action=>"show", :controller=>"questions", :dashboard_id=>"123", :dashboard_type=>"mono", :question_id=>"1234"}
In my routes.rb
file, I have this configuration:
resources :dashboards, :only => [:index, :all, :create] do
resources :questions, :path => '/:dashboard_type/questions'
end
What seems to be the problem?
Upvotes: 0
Views: 114
Reputation: 23711
Replace :question_id
with :id
It should be
url_for({
:action => "show",
:controller => "questions",
:dashboard_id => "123",
:dashboard_type => "mono",
:id => "1234",
:only_path => true
})
As there is no :question_id
dashboard_question GET /dashboards/:dashboard_id/:dashboard_type/questions/:id(.:format) questions#show
Upvotes: 2