Topic: serving d3

My question deals with D3, a javascript data visualization package.

To start off, I can get D3 to work by putting my html, json data files and javascripts in a folder somewhere on my local machine and then serving that folder with a simple python server.

The problem in rails is that I'm not sure where to put my json data files and the d3.js files. I've tried putting them in the public folder and setting config.serve_static_assets = true, but my app can't find routes to the public folder. I have also tried using the high_voltage gem to set up a folder for serving static pages. This seems to work except that anything in that folder is wrapped in my application.html layout, including the json and the javascript files. It doesn't work like this and I think that is the reason.

Also, the way D3 tries to find the json files it needs is with GET requests.

I'm feel there is probably an easy solution as to where to put everything so rails can find it.

Thanks

Edit: I know that the d3-rails gem exists and you don't have to explicitly include the d3.js file (which is the source) but with or without including it, it doesn't seem to work.

Last edited by apple_pie47 (2013-08-03 19:51:45)