Question

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

Was it helpful?

Solution

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]

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top