Using ERB in rails

I'm trying to do this:

erb = result = erb.result(binding)

When I run this I get "Can only render or redirect once per action" and I'm not sure why. I have been digging through the rails source but there is definitely something that I am not understanding.

Any ideas?

Thanks, Carl.

ERB doesn’t set either of the ‘performed’ instance variables; without seeing the context, it is hard to tell what the problem might be.

But, having been burned by this myself, make sure that you are exiting the action after you call render - doing this

if something render thing1 end render thing2

where ‘thing2’ is intended as a default action, will get you the DoubleRenderError

you’re describing. Adding a return statement after the first render will fix it. The default message for DoubleRenderError is much more informative than the replacement supplied by the render function - check it out for more detail.

Hope this helps,


I'm sorry that I posted that question. It was quite dumb. I had a render :partial in the template that I was running through ERB. Sorry to bother everyone.

Thanks, Carl.