I'm using render_to_string in an after_filter, which renders a partial
that is sent to a web service.  Here's the code:

class MyController < ApplicationController

after_filter :post_to_webservice

def show
# show logic
end

def post_to_webservice
stuff = render_to_string :partial => 'stuff'
webservice_post(stuff)
end

I get a DoubleRenderError in the after filter.  As I understand it,
the 'show' action will be rendered, but won't be sent to the browser
until the after filter is called.  Because the 'show' action is
already rendered (but not sent), we get a DoubleRenderError when
render_to_string is called.  Ideally, render_to_string should be
atomic and not mess with current rendering.

The work-around is to just call render_to_string before rendering
'show', but I want to keep my controller code DRY by putting the
webservice logic in an after_filter.

So is this a bug or a feature?

Thanks,
Shane

-- 
http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to