If you have an id
of the record in URL anyway, you don't need
Friendly_id gem. You need to tune routes.
But maybe you would be happy with something like this instead?
http://localhost:3000/profiles/1-john-smith
If so, you need to override to_param
method in User
model like
this:
class User < ActiveRecord::Base
def to_param
"#{id}-#{name}".parameterize
end
end
Now the profile_path(profile)
helper will generate URL like
http://localhost:3000/profiles/1-john-smith
And, with this request, the User.find(params[:id])
in controller
will find profile with id 1
and cut all other stuff which was in URL.
So
http://localhost:3000/profiles/1-mojombo-smith
will link to the same profile as
http://localhost:3000/profiles/1-john-smith