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! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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''. On Jan 25, 11:09 am, Cs Webgrl <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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! > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.