What is the benefit of naming instance variables this way…and does this sort of variable have a name?
def notes @_notes ||= Note.all end
Yes, that is what I was referring to. Thanks for the answer!
That’s a pattern that is actually used for caching a return value, the
_ prefix does mean we don’t care about the name of the variable, but that’s just a little bit of added semantics.
That makes sense, thanks
Just to confirm: routing to
/notes/:id was a typo, and we should always eliminate the leading slash in Backbone routes, yes?
@Tambling I thought the same, but watching the video further he shows the setting the
Backbone.history.start( pushState: true ) allows the forward slash to stay:
but just noticed you do have to remove the / in the code, kinda confusing, really have to pay attention to what he’s typing