ruby - What is correct path in .js file in Rails? -


i have js script plays video on home page , can't correct path video folder in script. works in html static project.

assets/javascript/common.js

var videobackground = new $.backgroundvideo($('#background-video'), {    "path": "/video/"  }); 

assets/javascript/video/ - videos in folder



i tried sending root_path variable in application file, doesn't work either.

application.html.haml

:javascript    var root_url = '#{rails.root}'; 

application.html.haml

var videobackground = new $.backgroundvideo($('#background-video'), {    "path": root_url + "/app/assets/javascripts/video/"  }); 

i not sure, if want assets, try putting video in app/assets/videos , in config/application.rb

config.assets.paths << "#{rails.root}/app/assets/videos" config.assets.enabled = true 

else put in public/videos then, video_tag "video.mp4" should automatically loaf there


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -