JST in Rails 4 app, using backbone.js

606 Views Asked by At

I am attempting to migrate a simple rails 4 app from server-side .erb (or .haml) to a single-page-app using backbone.js. Since I am new to this, I followed a Railcast tutorial, #323. The tutorial was done using Rails 3.2, but I used my current Rails 4 gemset. All went well until I attempted to use an .eco template to construct a view, as follows:

class Raffler.Views.EntriesIndex extends Backbone.View

  template: JST['entries/index']

  render: ->
      $(@el).html(@template())
      this    

When I inspect this with the js console (google chrome), I find that 'JST' is undefined. Is there something I need to include to make this work?

1

There are 1 best solutions below

0
Kirka121 On

for me

gem 'execjs'

in gemfile solved the problem of JST not being defined.