SOLUTION: It turns out that I was doing a redirect somewhere not obvious
before my rescue block was hit, and I wasn''t returning from the
redirect
(like I should have been - so that''s a bug in my code).
MORE GOOD NEWS: In order to figure this out, I ended up sifting through
the guts of ActionController#Base, and I discovered that there are two
variables internally which track whether or not a render or redirect has
been performed. So my hypothesis was correct. In addition, there are
two protected methods (which means that we can call them !!!), called
erase_render_results and erase_redirect_results, which wipe away any
render or redirect flags that have been set. When I put
erase_redirect_results in my rescue block, everything worked fine.
So, if you know what you are doing, and you need to escape the "double
render" box that Rails puts you in, you can use these two methods to
"wipe the slate clean" on your own as you need to.
As it turns out, in my case, I should have been redirecting before I
ever even attempted the begin/rescue block so I need to fix that.
_But_, _if_ my render_to_string call failed within the internal render,
so that erase_render_results didn''t get called internally, then a
mysterious double render error would show up.
Keep in mind that render_to_string doesn''t "count as a
render" only if
it completes successfully.
Wes
--
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
-~----------~----~----~----~------~----~------~--~---