这是我的link_to
<%= link_to sub_category.name, controller: :posts, action: :product, id: "#{sub_category.slug}-#{sub_category.id}" %>
哪个指向 url
http://localhost:3000/posts/product/fifith-category-s-sub-category-2
我需要如下网址
http://localhost:3000/fifith-category-s-sub-category-2
我该怎么做。
我的路线.rb
resources :posts
match ':controller(/:action(/:id))(.:format)', via: [:get,:post]