I’d like to use ERB in my JS templates. Sometimes I want <%= image_tag
%>, other times I might want something more serious/non-assety like <%=
form_for %>. (There was an issue for Sprockets to allow for ActionView
to be used in the asset pipeline so that that could work:
Possible to use ActionView in asset pipeline? · Issue #218 · sstephenson/sprockets · GitHub, but it turns out
it’s not so simple.)
I guess there are a few ways that I could do this, so I’m looking for a
best practice. How do you handle view helpers, like form_for? Do you
render your template within the view, or do you just use old school pure
html, or are there any bridge approaches?
Right now we’re trying out codebrew’s backbone-rails gem, but we
definitely need to find a migration path for the extensive system of
view helpers both in Rails and in our own project that we’d like to
reference.