Routes and permalinks problem

Hi.

I’ve got a user who wants url’s to look like this:
www.domain.com/firstname-lastname.

Right now I have a route set up like this
map.user ‘:user’, :controller => ‘user’, :action => ‘show’

This causes problems when I get robots and people searching for urls
that don’t map to an existing user. So I want to put in something that
will catch the 404’s, log them in a database and route the searcher to
an appropriate page.

Is this something where I should change the route code or put in a
redirect inside of my user controller if the user is not found?

Any help on either how to do either of these 2 or other options would be
greatly appreciated.

As a note, I am following the Adv Rails Recipes 404 code, but it’s not
quite working based on my current needs.

THANKS!

The book shows to do a catch-all route at the bottom of the route
file. map.connect ‘*path’, :controller => ‘foo’. The *path will put
the values in an array ‘path’.

Yep, I’ve got that in my routes file. The problem is that the map.user
picks up the url first and so it gets processed by that controller.

This is why I’m wondering what I need to change to get it all working
together.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs