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
Post a Comment