how to load a Javascript file to rails html erb

ruby-on-rails

Solution

If the javascript file is in any of the asset folders (assets, vendor, bundle) for Rails 3.x) you can add the script to your html.erb file by adding the following:

<%= javascript_include_tag('test.js') %>

Problem

Um trying to load a javascript file as follows to my html.erb file ``` <script src="/public/javascripts/test.js" type="text/javascript" /> ``` its available on the public folder and its in the root directory root/public/javascript but it giving me an error saying ``` "NetworkError: 404 Not Found - http://0.0.0.0:3000/public/javascripts/test.js" ``` what could possibly wrong ? is there a different way to include a javascipt file in rails ?

Original source