Reputation: 11423
I have successfully integrated friendly-id and is working fine. My product can be viewed from (localhost:3000/product/test-product
) url. What I want is to have a short url like (localhost:3000/test-product
) for my product.
How can I achieve this in friendly-id or in rails.
Thank you in advance.
Upvotes: 1
Views: 229
Reputation: 6438
You need to create your custom route to achieve this :
In routes.rb
get ':id' => 'products#show', as: :product
Call like
product_path(product.slug)
Upvotes: 1