5

When I use script tags in my index.html.erb the exact code runs fine but when I put the code in index.js.erb, I get the error:

Uncaught Rickshaw.Graph needs a reference to an element 

I tried precompileing assets, really don't know what else to try...

also here is my application.js

//= require rickshaw_with_d3
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

I did also try putting rickshaw on the bottom. Don't yet understand in what order things are loaded in rails, any ideas?

dan987
  • 333
  • 3
  • 10

1 Answers1

0

Had js comments '//' in the js.erb file. Those will stop it from loading because js.erb files are read as html and javascript by rails.

dan987
  • 333
  • 3
  • 10