Rails with backbone-rails: asset helpers (image_path) in EJS files

后端 未结 5 518
无人共我
无人共我 2020-12-13 11:24

I have a Rails 3.1 app that uses the codebrew/backbone-rails. In a .jst.ejs template, I would like to include an image, like so:



        
5条回答
  •  粉色の甜心
    2020-12-13 11:49

    For those willing to try HAML instead of EJS: Using haml-coffee through haml_coffee_assets has worked well for me as well.

    You can have the following in a .hamlc.erb file:

    %img(src="<%= image_path('foo.png') %>")
    

    (It still doesn't give you routing helpers though, only asset helpers.)

提交回复
热议问题