Problems with Hands-on Backbone.js on Rails workshop

I’m halfway through the 3rd video and seeing a couple of problems:

  1. Before I started this iteration, I saw the notes view, but when I click on a note title, I get an error: undefined local variable or method `note’ for #<#Class:0x007fd91ba03cb8:0x007fd91cf009e0>. Hovering over the link shows that it should be going to localhost:3000/notes/1. Various permutations of that URL, like localhost:3000/#note/1 or localhost:3000/#notes/1, do nothing.

  2. After adding the ScratchPadRouter, I expect to see the new links as shown in the @AllNotes array, but I’m still seeing the notes from the database. Seems like something is missing as far as my getting everything wired up correctly.

Help needed! I forked the repo and have committed my current code.

@seangriffin Any chance you’re available to take a look?

@Louise_Rains1 Can you post a link to your fork?

The NoMethodError is from a typo in your controller, you put helper_method :notes, :notes where it should have been helper_method :note, :notes. Still looking into why the JavaScript isn’t rendering.

The reason your javascript isn’t rendering is that you set the root route to "a function returning 'index', rather than just “'index'”. If you change this:

routes:
  '': -> 'index'

to

routes:
  '': 'index'

everything will work fine.