map.connect ':username', :controller => "users" , :action => "show"

At the bottom of your routes.rb file.
-----
Ryan Bigg







On 27/01/2009, at 1:07 PM, Louis-Pierre Dahito wrote:

>
>
>
> Brian Hogan wrote:
>> 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.
>
> Thx a lot but I really do want to get rid of the /user before  
> "username"
> so my url looks like this: http://mydomain.com/username... like i said
> before...
> http://twitter.com/gigaom for instance... How do i get rid of  
> "user/" in
> the url ????
>
> thx again
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
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