leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
649 stars 159 forks source link

Using Handlebars inside of Rails methods #96

Closed mtmcfarl closed 10 years ago

mtmcfarl commented 10 years ago

I think my question is potentially related to #95 and #89 but I'll ask it anyways.

I have a Handlebars view and I'd like to access the data and include it inside of a Rails method like so

<%= image_tag "adBuilder/templates/{{template.gender}}/template-0{{template.template}}-large.png", class: "" %>

I'd want the above line of code to resolve to

<img src="adBuilder/templates/male/template-01-large.png" />

Of course with the Rails fingerprinting from the asset pipeline.

Am I doing something wrong or is this not supported yet?

mtmcfarl commented 10 years ago

Update, the code does resolve the template data like it should. However the image_tag puts /images in front of the URL instead of /assets.

bcackerman commented 9 years ago

One thing to note is to make sure you have alt set to something. Even alt: ""