Redirect Issues

I have a controller file “maybies_controller.rb”

class MaybiesController < ApplicationController
def login
redirect_to “/maybies/categories”
end

def categories
    @category = Category.find(:all)
end

end

routes.rb file
map.connect ‘/maybies/:login’, :controller => ‘maybies’, :action =>
‘login’

map.connect ‘/maybies/:categories’, :controller => ‘maybies’, :action =>
‘categories’

The page is not re directing to categories page. It is getting stucked
in infinite loop in login page. pls help to resolve

Do you happen to have a filter that is directing all your users (who are
not
logged in) to the login page. That way they are going

/maybies/categories => /login => /maybies/categories => /login … etc…

Hope that helps,
Jim
http://www.thepeoplesfeed.com/contribute

On Tue, Sep 1, 2009 at 8:01 AM, Vijay Ks

James E. wrote:

Do you happen to have a filter that is directing all your users (who are
not
logged in) to the login page. That way they are going

/maybies/categories => /login => /maybies/categories => /login … etc…

Hope that helps,
Jim
http://www.thepeoplesfeed.com/contribute

On Tue, Sep 1, 2009 at 8:01 AM, Vijay Ks

can you give me the right code for this issue

Check if your controller classes and your application_controller.rb for
any
before_filters. Sometime authentication gems come with this type of
functionality. Are you using any?

On Tue, Sep 1, 2009 at 8:35 AM, Vijay Ks

James is right, I guess your categories page requires user’s to be
logged in
(ie, you have some before_filter in your controller), and in the login
action you are not properly setting appropriate login parameters (which
means user is not getting signed in through login action) You will have
to
check your login action.


Abhinav
http://twitter.com/abhinav

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