I'm still a novice at both Ruby on Rails and Backbone, and I'm trying to get Backbone to work on a Rails web app. It turns out that the Turbolinks gem on my Rails app is making things just a tad more complicated.
First, I found that if you install the Turbolinks gem, you have to keep the javascript tags in the 'HEAD' section of your page. You can't keep the JS tags in 'BODY'. So of course I move the javascript tags from 'BODY' to 'HEAD'. At that point, I didn't have my Backbone code implemented.
Then, I implement my Backbone code, and I run into problems with my template code giving me a "TypeError: text is undefined" message. When I tried to figure out this problem, It turned out that you have to define your template BEFORE my javascript, not after. My template is currently defined in the HTML, and this wasn't a problem when my javascript was at the bottom of the 'BODY' section. Now it's a problem since Turbolinks is forcing me to put my javascript in the 'HEAD' section.
Is there a workaround for this, or should I just disable Turbolinks?