3

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?

1
  • 1
    It 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. Commented Apr 22, 2015 at 21:27

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.