Trying to follow along with Ryan Bates Backbone.js tutorial to build a raffle application but i've already encountered problems with the first bit of code. In the init function of the application.js, he initialized the new instance of Raffler routes which is supposed to trigger the alert "Home Page" but I'm getting the following errors in Firebug that I don't understand
entries.js:5Uncaught ReferenceError: Raffler is not defined
entry.js:15Uncaught ReferenceError: Backbone is not defined
entries.js:23Uncaught ReferenceError: Backbone is not defined
index.js:17Uncaught ReferenceError: Backbone is not defined
application.js:7Uncaught SyntaxError: Invalid regular expression: missing /
raffler.js:9Uncaught TypeError: undefined is not a function
Any ideas how I can fix this?
javascripts/raffler/application.js
window.Raffler =
Models: {}
Collections: {}
Views: {}
Routers: {}
init: ->
new Raffler.Routers.Entries()
Backbone.history.start()
$(document).ready ->
Raffler.init()
routers/entries.js
class Raffler.Routers.Entries extends Backbone.Router
routes:
'': 'index'
index: ->
alert "home page"
Update
After I ran the generator //= require_tree .
was immediately after the require jquery_ujs which, i discovered (I think) is what caused some of the problems. However, I've now moved it to the bottom and am still getting this error
Raffler.Routers.Entries is not a constructor
[Break On This Error]
new Raffler.Routers.Entries();
Application.js
//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//
//= require .//raffler
//
//= require_tree ../templates/
//= require_tree .//models
//= require_tree .//collections
//= require_tree .//views
//= require_tree .//routers
//= require_tree .