Rails has a feature of loading scripts automatically when included in application.js or css like
//= require jquery
//= require jquery_ujs
# code below in the application.js file tells to load every script in the tree.
Now for common scripts you can use above method but, if you want to load controller specific scripts the you can follow the steps below:
- Add controller_name in the following line in file
- Add the following line in /config/initilizers/assets.rb to precompile additional assets.
Rails.application.config.assets.precompile += %w( bids.js )
- After Changing settings inside any file within config folder, you need to restart the server.