← cd ../blog
how-to-set-background-image-in-rails.md skrdev
~August 24, 2020 · 1 min read

How to set background-image in Rails

This one will be very short. When Sprokets compiling images following won't work on rails production server: body { background-image: url("paper.gif"); } It …

This one will be very short.

When Sprokets compiling images following won't work on rails production server:
body {
 background-image: url("paper.gif");
}
It will return 500 error due to "Can't find image"

Quick Fix by using embedded ruby:
style="background-image: url(<%= asset_path "paper.gif" %>);
Original post ↗

// keep reading

dmitrii skr.

I build fast, reliable web products — from the data model to the last pixel.

More

© 2026 Dmitrii Skrylev. All rights reserved.

Built with SvelteKit · Lantana, TX · Remote