I have two routes in my routes.rb : map.connect '''', :controller => "main", :action => "index" map.connect ''admin/:action/:id'', :controller => "admin" and I would like to add a last line that will route everything else to the function of a controlle eg: map.connect ''*'', :controller => "main", :action => "stuff" of course this is not correct but this is the idea I want /foo/bar/blahblah to be routed to the stuff method of main''s controller (and of course it will override the /404.htm in production mode) Can someone help ? I asked #rubyonrails without success --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Making my question short : Is there a way to use kind of wilcards in routes ? All my google searches leads me to a python implementation of rails routes which supports wilcards : http://routes.groovie.org/ Is there a way to do this in rails ??? On Nov 30, 6:18 pm, "Fabien Meghazi" <amigr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have two routes in my routes.rb : > > map.connect '''', :controller => "main", :action => "index" > map.connect ''admin/:action/:id'', :controller => "admin" > > and I would like to add a last line that will route everything else to > the function of a controlle > > eg: > > map.connect ''*'', :controller => "main", :action => "stuff" > > of course this is not correct but this is the idea > > I want /foo/bar/blahblah to be routed to the stuff method of main''s > controller > (and of course it will override the /404.htm in production mode) > > Can someone help ? I asked #rubyonrails without success--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fabien Meghazi wrote:> Is there a way to use kind of wilcards in routes ?Here''s a mapper to give each user a homepage with their own name in its URL: map.connect ''*login'', :controller => ''account'', :action => ''home_page'' And here''s the first line of the home_page action: user = User.find_by_login(params[:login].to_s) So can''t you replaced the find_by_login with some kind of regular expression, then redirect from its results? Note the path part appears in params[:login]. -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> map.connect ''*login'', :controller => ''account'', :action => ''home_page''Ok thanks, I was trying a star alone ''*'' but indeed, ''*path'' worked fine, thanks ! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---