Rails will use :id as the default parameter in resourceful routes.
This gives us the following routes:
But what if we aren’t looking up products by :id? We might want to look up products using a SEO-friendly permalink, or perhaps by using some token. You can obviously still pass that value as the id, but this can easily lead to confusion.
A better way is to specify the parameter.
This gives us the following routes:
The only sucky part is that Rails won’t automatically do the right thing when using link_to. So doing link_to @product will still generate a link using the product’s id. If you want to change that you can override the to_param method on your model.