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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Mitch, Check this out http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html . Best. Mike On Jul 8, 2008, at 8:59 AM, Mitchell Gould wrote:> > 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 > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8 Jul 2008, at 13:59, Mitchell Gould wrote:> > 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"] >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 " ) Fred> 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 > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Breen wrote:> Hey Mitch, > > Check this out > http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html > . > > Best. > MikeThanks Mike exactly the problem and the solution -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 8 Jul 2008, at 13:59, Mitchell Gould 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 > " ) > > > FredThank you Fred I will set it and forget it. Cheers, Mitch -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---