# Stack Too Deep

**URL:** <https://www.ruby-forum.com/t/stack-too-deep/142492>\
**Category:** Rails\
**Created:** [July 8, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/stack-too-deep/142492 "2008-07-08T14:59:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 8, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/stack-too-deep/142492/1 "2008-07-08T14:59:21Z")

</div>

I am using

redirect\_to :back for my login form. It works perfectly.

However when I ran some tests I got errors.

No HTTP\_REFERER was set in the request to this action,so redirect\_to  
:back could not be called successfully. If this is a test, make sure to  
specify request.env[“HTTP\_REFERER”]

So I replaced all of my :back with request.env[“HTTP\_REFERER”] in my  
controller. Now I get another error

stack level too deep

What can I use that will work the same as :back but pass tests.

I tried request.env\_table[“REQUEST\_URI”] which passes the test but fails  
my application because it does not work the same way as :back

Thanks you for your time.

Mitch

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 8, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/stack-too-deep/142492/2 "2008-07-08T15:12:35Z")

</div>

Hey Mitch,

Check this out  
[http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html](http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html)  
.

Best.  
Mike

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 8, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/stack-too-deep/142492/3 "2008-07-08T15:12:36Z")

</div>

On 8 Jul 2008, at 13:59, Mitchell G. wrote:

> to  
> specify request.env[“HTTP\_REFERER”]

I think what this means is that in the setup of your test you should  
set what the referer is (ie @request.env[“HTTP\_REFERER”] =  
"[http://something.example.com](http://something.example.com)  
" )

Fred

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 9, 2008, 3:07am UTC](https://www.ruby-forum.com/t/stack-too-deep/142492/4 "2008-07-09T03:07:19Z")

</div>

Michael B. wrote:

> Hey Mitch,
> 
> Check this out  
> [http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html](http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html)  
> .
> 
> Best.  
> Mike

Thanks Mike exactly the problem and the solution

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 9, 2008, 3:07am UTC](https://www.ruby-forum.com/t/stack-too-deep/142492/5 "2008-07-09T03:07:50Z")

</div>

Frederick C. wrote:

> On 8 Jul 2008, at 13:59, Mitchell G. wrote:
> 
> > to  
> > specify request.env[“HTTP\_REFERER”]
> 
> I think what this means is that in the setup of your test you should  
> set what the referer is (ie @request.env[“HTTP\_REFERER”] =  
> "[http://something.example.com](http://something.example.com)  
> " )
> 
> Fred

Thank you Fred I will set it and forget it.

Cheers,

Mitch
