Hello, I have an application where I am getting an odd error. If I do redirect_to url I get a DoubleRenderError. If I change that redirect_to url to a render :text => url. The action works fine. Why would I receive this error just by changing the way rails is responding? Regards, Devin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Apr 6, 2011 at 4:30 PM, Devin M <devinmrn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > I have an application where I am getting an odd error. If I do > redirect_to url I get a DoubleRenderError. If I change that > redirect_to url to a render :text => url. The action works fine. > > Why would I receive this error just by changing the way rails is > responding?The error is telling you that you are using redirect/render twice in the same action. Please post the controller code that is giving you the error so the group can better help you find the source of your error. B. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Heres the error:
AbstractController::DoubleRenderError in
FoursquareController#authenticate
app/controllers/foursquare_controller.rb:10:in `location''
app/controllers/foursquare_controller.rb:33:in `authenticate''
And the code:
def location
    session[:geolat] = params[:geolat]
    session[:geolong] = params[:geolong]
    render :nothing => true
end
def authenticate
    redirect_to "https://foursquare.com/oauth2/authenticate?
client_id=#{FOURSQUARE_OAUTH_CONFIG[:client_id]}
&response_type=code&redirect_uri=#{FOURSQUARE_OAUTH_CONFIG[:redirect_uri]}"
end
Why does it even call location when thats not even mentioned the
action being called?
I only get this error if i change authenticate to have redirect_to
On Apr 6, 4:27 pm, Bryan Crossland
<bacrossl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> On Wed, Apr 6, 2011 at 4:30 PM, Devin M
<devin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Hello,
> > I have an application where I am getting an odd error. If I do
> > redirect_to url I get a DoubleRenderError. If I change that
> > redirect_to url to a render :text => url. The action works fine.
>
> > Why would I receive this error just by changing the way rails is
> > responding?
>
> The error is telling you that you are using redirect/render twice in the
> same action. Please post the controller code that is giving you the error
so
> the group can better help you find the source of your error.
>
> B.
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Sent from my iPhone On Apr 6, 2011, at 9:38 PM, Devin M <devinmrn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Heres the error: > > AbstractController::DoubleRenderError in > FoursquareController#authenticate > app/controllers/foursquare_controller.rb:10:in `location'' > app/controllers/foursquare_controller.rb:33:in `authenticate'' > > And the code: > > def location > session[:geolat] = params[:geolat] > session[:geolong] = params[:geolong] > render :nothing => true > end > def authenticate > redirect_to "https://foursquare.com/oauth2/authenticate? > client_id=#{FOURSQUARE_OAUTH_CONFIG[:client_id]} > &response_type=code&redirect_uri=#{FOURSQUARE_OAUTH_CONFIG[:redirect_uri]}" > end > > Why does it even call location when thats not even mentioned the > action being called? > I only get this error if i change authenticate to have redirect_to >From the error message it appears you are calling authenticate from what is being rendered on a location call.> On Apr 6, 4:27 pm, Bryan Crossland <bacrossl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Wed, Apr 6, 2011 at 4:30 PM, Devin M <devin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> Hello, >>> I have an application where I am getting an odd error. If I do >>> redirect_to url I get a DoubleRenderError. If I change that >>> redirect_to url to a render :text => url. The action works fine. >> >>> Why would I receive this error just by changing the way rails is >>> responding? >> >> The error is telling you that you are using redirect/render twice in the >> same action. Please post the controller code that is giving you the error so >> the group can better help you find the source of your error. >> >> B. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sent from my iPhone On Apr 6, 2011, at 9:38 PM, Devin M <devinmrn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Heres the error: > > AbstractController::DoubleRenderError in > FoursquareController#authenticate > app/controllers/foursquare_controller.rb:10:in `location'' > app/controllers/foursquare_controller.rb:33:in `authenticate'' > > And the code: > > def location > session[:geolat] = params[:geolat] > session[:geolong] = params[:geolong] > render :nothing => true > end > def authenticate > redirect_to "https://foursquare.com/oauth2/authenticate? > client_id=#{FOURSQUARE_OAUTH_CONFIG[:client_id]} > &response_type=code&redirect_uri=#{FOURSQUARE_OAUTH_CONFIG[:redirect_uri]}" > end > > Why does it even call location when thats not even mentioned the > action being called? > I only get this error if i change authenticate to have redirect_to >Hit send before I meant to. It looks like, from the error message, that from your render action in location you are calling authenticate which then tries to redirect before the render from location is complete. This is a no no. It works when you switch it to render_to because that is a acting like a nested render which is ok. You might want to rethink how you want to do that authentication if you really need that redirect. B.> On Apr 6, 4:27 pm, Bryan Crossland <bacrossl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Wed, Apr 6, 2011 at 4:30 PM, Devin M <devin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> Hello, >>> I have an application where I am getting an odd error. If I do >>> redirect_to url I get a DoubleRenderError. If I change that >>> redirect_to url to a render :text => url. The action works fine. >> >>> Why would I receive this error just by changing the way rails is >>> responding? >> >> The error is telling you that you are using redirect/render twice in the >> same action. Please post the controller code that is giving you the error so >> the group can better help you find the source of your error. >> >> B. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.