what’s the best approach for making reference for assets, for nested urls.
e.g. if in my html I refer to image this way: , it does not work when the url is myapp/admin/edit/1 or any custom url.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the asset tag helpers,
image_tagand so on:http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
Wherever your current path is should make no difference, as accessing assets should be done from root, e.g.
/images/whatever.jpg,/stylesheets/whatever.cssThe asset tag helpers will make this transparent, and additionally, they will transform paths for you if you ever use an asset host other than your web server. For example.