Rails route to specific action for resource -


i'm trying url given params:

url_for({   :action => "show",   :controller => "questions",   :dashboard_id => "123",   :dashboard_type => "mono",   :question_id => "1234",   :only_path => true }) 

but error:

actioncontroller::routingerror: no route matches {:action=>"show", :controller=>"questions", :dashboard_id=>"123", :dashboard_type=>"mono", :question_id=>"1234"} 

in routes.rb file, have configuration:

resources :dashboards, :only => [:index, :all, :create]   resources :questions, :path => '/:dashboard_type/questions' end 

what seems problem?

replace :question_id :id

it should be

url_for({   :action => "show",   :controller => "questions",   :dashboard_id => "123",   :dashboard_type => "mono",   :id => "1234",   :only_path => true }) 

as there no :question_id

dashboard_question    /dashboards/:dashboard_id/:dashboard_type/questions/:id(.:format)      questions#show 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -