Shopify/batman — Issue #216: event actions that render lead to DoubleRenderErrors
Author: tractionlabs
Created: 2011-11-08 08:27:31+00:00
State: open

A useful pattern that I have used a couple of times is to bind an event to an action on a batman controller that calls render. At some point after the 0.7.5 release, master was changed in a way that makes this pattern unavailable. It works fine if the event only fires once; if the event fires twice in a row, then the second occurance leads to a DoubleRenderError.

I can see ways to restructure my views and controllers so as to live with this new restriction (that events can not render or redirect), but it's awkward and I wonder if it is really necessary.

Example: bind the change event on a select to an action that renders into the DOM the rest of a form, based on the choice made in the select.

Is this a bug, or a deliberate design choice? If the latter, are we now meant to only affect the DOM during event handling by using something like jquery?