Jake
Jake

Reputation: 31

Implementing Coffeescript into Rails Application

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?

Upvotes: 3

Views: 59

Answers (1)

Mike Manfrin
Mike Manfrin

Reputation: 2762

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).

Upvotes: 2

Related Questions