标签: ruby-on-rails ruby-on-rails-3
products_path(page: 1)生成网址/products?page=1。
products_path(page: 1)
/products?page=1
如何生成/products/page/1?
/products/page/1
假设我有
resources :products
routes.rb
。
答案 0 :(得分:1)
将此添加到routes.rb:
match "/products/page/:page" => "products#index"
它将在params散列中设置page参数。