0

The way I have it right now is that I use JavaScript to read a file, providing a hard coded path. I tell it to look it /public. I'm going to generate a file in the tmp directory with Rails, and I want to read it with JavaScript. How can I do this? What is the tmp directory of Rails?

I've tried putting the file into /tmp and hard coding JavaScript to read from /tmp, but it doesn't load the file.

Jonah Bishop
  • 12,279
  • 6
  • 49
  • 74
Jack
  • 5,264
  • 7
  • 34
  • 43

1 Answers1

1

I might be wrong but I think browser can access only files inside public folder unless it goes through Rails route. So, you can either change the location of tmp folder or you can create a method in a controller that will read that JS file and send it back to browser (sort of like proxy).

nicholasnet
  • 2,117
  • 2
  • 24
  • 46