I''ve started out my new rails app by setting up users and sessions by following the example in the FlexibleRails book. This uses the restful_authentication plugin. It then generates users sessions and sets up basic routes like map.resources :users map.resource :session map.signup ''/signup'', :controller => ''users'', :action => ''new'' map.login ''/login'', :controller => ''sessions'', :action => ''new'' map.logout ''/logout'', :controller => ''sessions'', :action => ''destroy'' After setting all that up I tested it manually and ran rake to run the tests, and everything worked fine. Then I started generating my scaffolds and models, and probably waited too long to run tests again. Now when I run rake, I get a bunch of errors in UserController and SessionController. In addition, when I go to localhost:3000/signup, which is supposed to take me to the generated new user screen, I get an infinite redirect to session/new. Here''s the log for the signup page: Processing UsersController#new (for 127.0.0.1 at 2009-02-18 10:07:57) [GET] Session ID: BAh7BzoOcmV0dXJuX3RvIhEvc2Vzc2lvbi9uZXciCmZsYXNoSUM6J0FjdGlv%0AbkN vbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA%3D-- a1d287f3622f9cc0c08e2f5 7691a42ef83a3e811 Parameters: {"action"=>"new", "controller"=>"users"} ←[4;36;1mSQL (0.000000)←[0m ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m Redirected to http://localhost:3000/session/new Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://localhost/signup] Processing SessionsController#new (for 127.0.0.1 at 2009-02-18 10:07:57) [GET] Session ID: BAh7BzoOcmV0dXJuX3RvIgwvc2lnbnVwIgpmbGFzaElDOidBY3Rpb25Db250%0Acm9 sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA-- c95428aa8926994b68c56d23ff54ca430 cd6263a Parameters: {"action"=>"new", "controller"=>"sessions"} Redirected to http://localhost:3000/session/new Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://localhost/session/new] I''m not sure what that ''SET SQL_AUTO_IS_NULL'' is or if it''s normal or not. I googled it but didn''t find anything relevant. The UsersController class only defines an empty method for new, so it''s suppose to show the new.rhtml, right? Why is it redirecting to the session controller? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jemminger
2009-Feb-18 22:10 UTC
Re: why is user/new redirecting to sessions/new and then looping?
Is there maybe a before_filter to redirect to the login page when not logged in? On Feb 18, 10:44 am, Brian <brifo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve started out my new rails app by setting up users and sessions by > following the example in the FlexibleRails book. This uses the > restful_authentication plugin. It then generates users sessions and > sets up basic routes like > > map.resources :users > map.resource :session > > map.signup ''/signup'', :controller => ''users'', :action => ''new'' > map.login ''/login'', :controller => ''sessions'', :action => ''new'' > map.logout ''/logout'', :controller => ''sessions'', :action => > ''destroy'' > > After setting all that up I tested it manually and ran rake to run the > tests, and everything worked fine. > > Then I started generating my scaffolds and models, and probably waited > too long to run tests again. Now when I run rake, I get a bunch of > errors in UserController and SessionController. In addition, when I > go to localhost:3000/signup, which is supposed to take me to the > generated new user screen, I get an infinite redirect to session/new. > Here''s the log for the signup page: > > Processing UsersController#new (for 127.0.0.1 at 2009-02-18 10:07:57) > [GET] > Session ID: > BAh7BzoOcmV0dXJuX3RvIhEvc2Vzc2lvbi9uZXciCmZsYXNoSUM6J0FjdGlv%0AbkN > vbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA%3D-- > a1d287f3622f9cc0c08e2f5 > 7691a42ef83a3e811 > Parameters: {"action"=>"new", "controller"=>"users"} > ←[4;36;1mSQL (0.000000)←[0m ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m > Redirected tohttp://localhost:3000/session/new > Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found > [http://localhost/signup] > > Processing SessionsController#new (for 127.0.0.1 at 2009-02-18 > 10:07:57) [GET] > Session ID: > BAh7BzoOcmV0dXJuX3RvIgwvc2lnbnVwIgpmbGFzaElDOidBY3Rpb25Db250%0Acm9 > sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA-- > c95428aa8926994b68c56d23ff54ca430 > cd6263a > Parameters: {"action"=>"new", "controller"=>"sessions"} > Redirected tohttp://localhost:3000/session/new > Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found > [http://localhost/session/new] > > I''m not sure what that ''SET SQL_AUTO_IS_NULL'' is or if it''s normal or > not. I googled it but didn''t find anything relevant. > > The UsersController class only defines an empty method for new, so > it''s suppose to show the new.rhtml, right? Why is it redirecting to > the session controller?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---