meleyal / backbone-on-rails

A simple gem for using Backbone.js with Rails.
MIT License
810 stars 126 forks source link

JST index templates not available by name #69

Closed jkopczyn closed 9 years ago

jkopczyn commented 9 years ago

I have a Backbone View ReviewsIndex, wrote the template in templates/reviews/index.jst.ejs, and attempted to give it the template JST["reviews/index"], but this was said to be undefined.

Hours later, I discovered the JST["reviews"] alias. Which is nice, but not being able to invoke it by name as expected caused me endless headache. Please fix this undocumented feature.

EDIT: I'm (reluctantly) using Javascript, not Coffeescript.

meleyal commented 9 years ago

Hm, not sure why you'd be seeing that. This gem does nothing to modify the way ejs works.

Maybe an issue with ruby-ejs?

jkopczyn commented 9 years ago

I'll look into that. I'm in a group who were all using a similar setup, and the difference seemed to be that I used your scaffold generation, so I assumed that was the cause.

awendt commented 9 years ago

@jkopczyn I ran into a similar issue without this gem. Can you check your router code please? I suspect it contains this:

routes: {
  "": "index"
},

which just means: reviews/index will be available under route reviews.

jkopczyn commented 9 years ago

I definitely did that. Thanks for mentioning it.