I am trying to get the CoffeeScript class for the Backbone.Model extension. I created a new rails 3.1 application, created a Stone scaffold with three attributes, and fixed a Todos.coffee example fragment in a .js.coffee stone. I have both backbone.js and underscore.js in the app / assets / javascripts folder. When I run this under the Chrome Java console, I get the message above in the console log. Any ideas?
Current code:
$ -> class Todo extends Backbone.Model # Default attributes for the todo. defaults: content: "empty todo..." done: false # Ensure that each todo created has `content`. initialize: -> if !@get ("content") @set({ "content": @defaults.content }) # Toggle the `done` state of this todo item. toggle: -> @save({ done: !@get ("done") }) # Remove this Todo from *localStorage* and delete its view. clear: -> @destroy() @view.remove()
The application.js used is what Rails 3.1 created. I copied backbone.js and underscore.js from the Todos github repository, https://github.com/JasonGiedymin/backbone-todojs-coffeescript
source share