Say that I have pulled a fancy.js file from somewhere online, what are the steps that I should take to include it in my Rails 4 application?
Right now I have the following
Are there more steps after 1 and 2, or am I doing this all wrong to begin with?
Looks like you are on the right path. Take a look inside app/assets/javascripts/application.js
When you created a new app (i.e., rails new app_name
), it should have added
//= require_tree .
Simply add references to additional javascript files you wish to include.
EXAMPLE
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require fancy
//= require_tree .
You can find more info on Adding Javascript File to Rails
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With