我需要一个路由来接受reports#show
带有附加:query
参数的请求,但我不知道如何编写它。在我看来,它需要响应这个链接:
= link_to report_path(query: params[:query]) do
配置/路由.rb
resources :reports do
resources :chapters
resources :pages
end
尝试了以下变化:get '/reports/:id/:query', :as => 'reports_query'
但我不断得到:
Routing Error
No route matches {:action=>"show", :controller=>"reports", :query=>"europe"}
项目主要是 RESTful,但我会在这一点上采用任何可行的方法。谢谢你的帮助。