Is there any way to pass a variable context to the {{render}}
helper?
For instance, I have a polymorphic relationship on my model, and I want to render the appropriate view for each different type (without have to write a whole string of if
statements.
my events
template looks like this:
<ul>
{{#each event in model}}
<li>
{{event.time}} {{render event.type event.eventable}}
</li>
{{/each}}
</ul>
the event.type
is a string and is set to song
. If I use {{render 'song' event.eventable}}
everything works great. But passing the variable string 'song'
produces nothing.
Can this be done?