如何在Spree中更改默认产品路线?

时间:2014-02-18 21:24:52

标签: ruby-on-rails spree

有关更改此网址所需路线的任何想法:

http://domain.com/products/item1

要显示和链接到这样:

http://domain.com/item1/products

目前的路线如下:

root_path            GET                         /                               spree/home#index
products_path        GET                         /products(.:format)             spree/products#index
                     POST                        /products(.:format)             spree/products#create
new_product_path     GET                         /products/new(.:format)         spree/products#new
edit_product_path    GET                         /products/:id/edit(.:format)    spree/products#edit
product_path         GET                         /products/:id(.:format)         spree/products#show
                     PATCH                       /products/:id(.:format)         spree/products#update
                     PUT                         /products/:id(.:format)         spree/products#update
                     DELETE                      /products/:id(.:format)         spree/products#destroy

1 个答案:

答案 0 :(得分:2)

您需要在路线前加上:

get '/:id/products/' => 'spree/products#show', as: :product

到您的config/routes.rb文件。