This is the CSS in my page.css.scss
#test {
background-image: image-url("bigstock.jpg")
}
This is my routes.rb
Rails.application.routes.draw do
get ':controller(/:action(/:id))'
root 'page#index'
When I visit localhost:3000
I see the texts but no image.
When I try to navigate to the address in the CSS, http://localhost:3000/assets/bigstock.jpg
, I get the error message:
No route matches [GET] "/assets/bigstock-blured-lighhts-from-peak-Victo-63827467.jpg"
I am new to rails and have tried many different methods here like using asset-url
, background
, image_path
but nothing works.
I couldn't do try setting config.serve_static_assets = true
though as it throws some errors.
Since this is a fresh install, it shouldn't be too difficult to do something so simple? I guess I might be heading in the wrong direction.
Update:
I have just tried config.serve_static_assets = true
. Didn't help. Added it in the wrong place intially.