Closed ddrake closed 11 years ago
I noticed that the railscast was based on Backbone version 0.9.1, while the current version of this gem is using version 1.0.0, but I've been through the backbone changelog and looked at the tests at github and still can't see where I'm going wrong...
Ok, you can close this. I figured it out. The problem was in entries.router.js.coffee; my indentation was wrong. It needs to be like this instead:
class Raffler.Routers.Entries extends Backbone.Router
routes:
'': 'index'
index: ->
alert 'home page'
I was setting index as a property of the routes object.
Hi, I'm walking through the Railscasts backbone #1 episode, but using Rails 4.0.0 and Ruby 2.0. At this point, requesting the root should display an alert dialog with message 'home page', but I'm not getting that. Here's my code:
entries.router.js.coffee
raffler.js.coffee
In the rails application, I'm rooting to "main#index" which is correctly rendering the view with the div showing "loading", but I'm not getting the alert dialog.
I'm not seeing any javascript errors in either Firefox 12 or Chrome ver. 28.0. When I step through the code, I can see that Backbone.history.start() is returning true, indicating that the url matched the route.
I removed the turbolinks gem from my bundle (and also from application.js and the layout), but that doesn't seem to have been the issue.
Can anyone spot what I'm doing wrong or recommend some way that I can debug this?