Topic: Redirect issues

I have the page "login.rhtml"  and "categories.rhtml".
If the user enters the username and password then the page should be redirected to "categories.rhtml".
Here is the router.rb file
--------------------------------------------------------------------------------------------------
map.connect '/maybies/:login', :controller => 'maybies', :action => 'login'
  map.connect '/maybies/:categories', :controller => 'maybies', :action => 'categories'
---------------------------------------------------------------------------------------------------------------
Here is the controller

def login
        redirect_to "/maybies/categories"
end

But i am not able to get the categories page.It is stucking in infinite loop.

Pls help

Re: Redirect issues

that is because you use symbol wildcards in your routes while you shouldn't in this case, as :login and :category are explicit action named and not parameters that should be matched with a wildcard-like behaviour.

wrong:


map.connect '/maybies/:login', :controller => 'maybies', :action => 'login'
  map.connect '/maybies/:categories', :controller => 'maybies', :action => 'categories'

right:

map.connect '/maybies/login', :controller => 'maybies', :action => 'login'
  map.connect '/maybies/categories', :controller => 'maybies', :action => 'categories'


PS: Moved to correct section