Well, I haven't watched the screencast, but can't really imagine how "harmful" that could be.
The first thing you would need to do is use the permalink_fu plugin -> http://github.com/technoweenie/permalink_fu/tree/master And then you could override the "find" method in your model to a finder like this one: def find( *args ) if args.first.kind_of?( String ) and !args.first.kind_of?( Symbol ) and (args.first !~ /^[0-9]/ || args.first.include?('-')) if args.size == 1 super :first, :conditions => { permalink_field => args.first } else with_scope :find => { :conditions => { permalink_field => args.first } } do args[ 0 ] = :first super( *args ) end end else super( *args ) end end What would assure that if a number is passed, it would use the good old finder, but if it's not a number, it will try to find using the permalink_field. This has solved my needs, maybe it can solve yours too. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sun, Jan 25, 2009 at 5:21 PM, Louis-Pierre Dahito <rails-mailing-l...@andreas-s.net> wrote: > > Hey guys, > > How do we create Permalinks for users in a Rails application ??? > By Permalink a mean the name of the user in the URL like so: > example.com/username... Or like twitter and everyone does it ex: > twitter.com/username... > > I checked everywhere for that and didnt find a relevant answer... > I think it has something to do with overriding the to_param method in > the User model... but according to this screencast from Ryan Bates, > http://railscasts.com/episodes/63-model-name-in-url, it's very risky to > remove the id from the url... > > Is there a way to do it ??? I suppose there is... > > Thx for your help... > > Louis-Pierre > -- > 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---