I have the record's ID and name in the URL.
def to_param
"#{id} #{name}".parameterize
end
But any name works in the URL. I can do the following and it works
www.site.com/records/ID-anything-here-works
How can I redirect ID-anything to ID-name?
Here is an example.
Let's say I have a "product" model and a record with the name "shoe" and an id "6".
The url looks like this
products/6-shoe
But this URL also works
products/6-eiufwojfeowjfowef
How can I make it so the second URL redirects to the first?
I'm working with the show action:
def show
@website = Website.find(params[:id])
end