Backbone + Rails 5

时间:2018-05-22 03:13:01

标签: ruby-on-rails backbone.js

我尝试使用image_path将图片放在骨干视图上,如:

<%= image_path('logo.png') %>

但它不起作用。我收到一条错误消息:

Uncaught ReferenceError: image_path is not defined

我不知道如何配置image_path以便在/assets/images中进行搜索。

login_index.coffee

class viaapp.Views.Login extends Backbone.View

template: JST['logins/login_index']

render: (username) ->
@username = username
$(@el).html(@template({user: @username}))
@

login_index.jst.ejs

<img id="profile-img" class="profile-img-card" src="<%= asset_path ('logo.png') %>" />

0 个答案:

没有答案