Tom Wilcoxen
2005-Jun-28 14:50 UTC
redirect_to external link from controller suppress layout
I have a payment screen where a user clicks a PayPal button, goes to
my controller where I create an object and then forward them on to
PayPal. It works using this:
url = PAYPAL_URL << "?" <<
post_params.join("&")
redirect_to url
render_without_layout
But I get a layout not found error because (I believe) control
navigates away before the render call is made. It actually works fine
from the browser''s point of view, but I do get an error generated in
the log and I''m guessing there''s a way to do this more
cleanly.
Any ideas?
Thanks,
Tom
--
Tom Wilcoxen
http://convergentarts.com
http://www.dreamhost.com/r.cgi?twilcoxen
Duane Johnson
2005-Jun-28 16:33 UTC
Re: redirect_to external link from controller suppress layout
On Jun 28, 2005, at 8:50 AM, Tom Wilcoxen wrote:> I have a payment screen where a user clicks a PayPal button, goes to > my controller where I create an object and then forward them on to > PayPal. It works using this: > > url = PAYPAL_URL << "?" << post_params.join("&") > redirect_to url > render_without_layout >You could use redirect_to_url(url) as well. That might nullify the need to render_without_layout also. Duane Johnson (canadaduane)
Tom Wilcoxen
2005-Jun-28 18:00 UTC
Re: redirect_to external link from controller suppress layout
Aha, perfect, thanks Duane. I''d seen in rails trac that redirect_to_url would be deprecated in favor of the using the shorter form, which would be smart enough to act appropriately. But I guess you lose the smart render suppression if you do that without using edge rails. Thanks! -Tom On 6/28/05, Duane Johnson <duane.johnson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Jun 28, 2005, at 8:50 AM, Tom Wilcoxen wrote: > > > I have a payment screen where a user clicks a PayPal button, goes to > > my controller where I create an object and then forward them on to > > PayPal. It works using this: > > > > url = PAYPAL_URL << "?" << post_params.join("&") > > redirect_to url > > render_without_layout > > > > You could use redirect_to_url(url) as well. That might nullify the > need to render_without_layout also. > > Duane Johnson > (canadaduane) > > >-- Tom Wilcoxen http://convergentarts.com http://www.dreamhost.com/r.cgi?twilcoxen
Neville Burnell
2005-Jun-29 00:05 UTC
RE: redirect_to external link from controller suppress layout
I''m fairly sure you don''t need the
"render_without_layout" ...
The redirect will be sent to the browser and so the render will attempt
to write to a closed connection
-----Original Message-----
From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On
Behalf Of Tom Wilcoxen
Sent: Wednesday, 29 June 2005 12:51 AM
To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails] redirect_to external link from controller suppress
layout
I have a payment screen where a user clicks a PayPal button, goes to my
controller where I create an object and then forward them on to PayPal.
It works using this:
url = PAYPAL_URL << "?" <<
post_params.join("&")
redirect_to url
render_without_layout
But I get a layout not found error because (I believe) control navigates
away before the render call is made. It actually works fine from the
browser''s point of view, but I do get an error generated in the log and
I''m guessing there''s a way to do this more cleanly.
Any ideas?
Thanks,
Tom
--
Tom Wilcoxen
http://convergentarts.com
http://www.dreamhost.com/r.cgi?twilcoxen
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails