I generated a scaffold in ruby and I want to insert a background image to every page on the site but Im not sure what the link to the image should be.
my image is in app/assets/images/"dep.jpg"
this is what i have but it isnt working:
background-image:url('../images/dep.jpg');
}
Any help? thanks
The webserver in rails takes
publicfolder as the base of the application. Hence its looking for the specific image under/public/images/instead ofapp/assets/images/"dep.jpg"& since its not there over there you cannot get the image. Try to put your image in/public/images/folder then it would work.Edit: If you are using rails 3.1 then this would be different as Rails 3.1 uses the concept of asset pipeline for the assets of your application so then then path
app/assets/images/dep.jpgwould obviously work.