I am learning ROR by creating a webpage, but am not able to set a bg image, tried different ways but no luck yet.
Hope someone can help...
Thanks in advance.
CodePudding user response:
Am a rookie in ruby but I did tried to put bg image and struggled a bit but finally I was able to find a way for it.
Try this and let me know if this helped or not.
In your CSS:
background-image: url(background.jpg);
or
background-image: url(/assets/background.jpg);
In environments/production.rb:
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true