LOL
There's no reason to use to_param.  It's just a convention to pass the
id through the URL. It's type is not enforced.

# expects /users/15
def edit
  @user = User.find(params[:id])
end

# expects /users/bphogan
def show
  @user = User.find_by_username(params[:id])
end

The only thing to watch out for is that find throws a RecordNotFound
exception when there is no record found, which will display a 404 in
production, and find_by_username returns nil, so you'll wanna handle
that.

But there's no need to do anything funny with to_params or routing or
anything like that.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to