I've been trying to render a underscore.js template, that is just like ERB on some haml content.
But as the templates grow I dont want to do more like this
%script{:type => "text/template", :id => "my_template"}
:plain
<div><%= my_js_value %></div>
.....(other content)...
and instead of that I want to use partials to render inside it I wish to do something like:
%script{:type => "text/template", :id => "my_template"}
=render :file => "mytemplate.txt"
But that rendering tried to bind the ERB on it, and I've got errors for my_js_value
The only way I get to do this rendering is through that way:
%script{:type => "text/template", :id => "my_template"}
=render :text => File.read("#{Rails.root}/app/views/mycontroller/mytemplate.txt")
The last one worked for me, but I was looking for something better than that.
What do you suggest me to do instead of reading a file? Isn't there a "raw" option for render?
BTW this is on a rails 2.3.14 app