# I'm not being redirect to the page I expect

**URL:** <https://www.ruby-forum.com/t/im-not-being-redirect-to-the-page-i-expect/111243>\
**Category:** Rails\
**Created:** [August 4, 2007, 6:32am UTC](https://www.ruby-forum.com/t/im-not-being-redirect-to-the-page-i-expect/111243 "2007-08-04T06:32:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Holsy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/73ab20/32.png) [@Holsy](https://www.ruby-forum.com/u/Holsy)\
**Post date:** [August 4, 2007, 6:32am UTC](https://www.ruby-forum.com/t/im-not-being-redirect-to-the-page-i-expect/111243/1 "2007-08-04T06:32:44Z")

</div>

Hey everyone,

I’m new to ruby on rails and have run into something that does not  
seem right. I installed the login\_generator “gem install  
login\_generator”. and got everything working just fine, but I found  
one strange problem.

If I go to the address [http://localhost:3000/cookbook/recipe](http://localhost:3000/cookbook/recipe) I am  
prompted for a password. I enter it and am logged in. However I am  
sent to the page [http://localhost:3000/cookbook/recipe/index](http://localhost:3000/cookbook/recipe/index) …and  
you guessed it there is no index view so I get an error.

If I am already logged in and I go to the page  
[http://localhost:3000/cookbook/recipe](http://localhost:3000/cookbook/recipe)  
I am redirected to [http://localhost:3000/cookbook/recipe/list](http://localhost:3000/cookbook/recipe/list).

Is this the correct behavior?

In the login controller redirect\_back\_or\_default is called. How  
exactly does redirect\_back\_or\_default work?
