I have a CoffeeScript that I am trying to add into my current rails application. Once the script is in the assets/javascript folder how do I actually make it display on the page? I've gone through a bunch of tutorials and am still completely lost. Do I need to make a new controller?
-
1It would help if you posted your coffeescript and gave us some indication of what it was supposed to do. Your script could be anything, so "make it display" becomes a pretty vague request. And no, you don't need a new controller.MarsAtomic– MarsAtomic2015-04-22 21:27:58 +00:00Commented Apr 22, 2015 at 21:27
Add a comment
|
1 Answer
Coffeescript is included as a default gem in Rails. Confirm by checking in your Gemfile.
Coffeescript is a language that compiles, so it won't 'display' on a page -- when you make a .coffee file, Rails will compile it to JavaScript when the page is loaded (or before, depending on how you do asset compilation). A coffeescript page is included the same way a js page is included (open your application.js page -- it'll have a comment explaining how to include JS).