← Back to Upcase

Problems with Hands-on Backbone.js on Rails workshop

(Louise Rains) #1

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.

(Ben Orenstein) #2

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

(Sean Griffin) #3

@Louise_Rains1 Can you post a link to your fork?

(Sean Griffin) #4

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.

(Sean Griffin) #5

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:

  '': -> 'index'


  '': 'index'

everything will work fine.