title: What is correct path in .js file in Rails?
body: <p>I have a js script which plays a video on my home page and I can't get the correct path to the video folder in this script. It only works in an html static project. </p>
  
  <p><em>assets/javascript/common.js</em></p>
  
  <pre><code>var videobackground = new $.backgroundVideo($('#background-video'), {
  
    "path": "/video/"
  
  });
  </code></pre>
  
  <p><em>assets/javascript/video/</em> - my videos in this folder</p>
  
  <hr>
  
  <hr>
  
  <p>I tried sending the <code>root_path</code> variable in my application file, but it doesn't work either.</p>
  
  <p><em>application.html.haml</em></p>
  
  <pre><code>:javascript
  
    var ROOT_URL = '#{Rails.root}';
  </code></pre>
  
  <hr>
  
  <p><em>application.html.haml</em></p>
  
  <pre><code>var videobackground = new $.backgroundVideo($('#background-video'), {
  
    "path": ROOT_URL + "/app/assets/javascripts/video/"
  
  });
  </code></pre>