The solution is each time you query on a rails 3 app use:
Profile.find_by_slug(params[:id])
if you use a rails 4 app
Profile.find_by slug: params[:id]
質問
First sorry for my english i am french
I am using Frindly_id gem to generate clean url and it work just fine i still have a problem, for example let's say i have a user with user_id=1 and a full_name = = "olivier logaro" so when i go to this user profile i have this url localhost:3000/profile/olivier-logaro so that what i want but the problem is when i go to localhost:3000/profile/1 it will give me the profile of olivier logaro. So what i want is to have acces to the users profile whith just the first url and if i try the second url i will have a error this url doesn't exit
解決
The solution is each time you query on a rails 3 app use:
Profile.find_by_slug(params[:id])
if you use a rails 4 app
Profile.find_by slug: params[:id]
他のヒント
You can find the answer here: https://github.com/norman/friendly_id/issues/146. And its a duplicate ;) Rails friendly_id pages still attainable by record id