Images and assets not working in my production server on rails 3.1.0

后端 未结 3 1964
栀梦
栀梦 2020-12-14 04:21

I switched my server to production and i cannot get any of my images to load. It all works fine on development mode but when i switched to production it all stopped working

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 05:24

    If you are upgrading to Rails 4 or are currently using it on production, and are loading images from css, then:

    instead of

    background-image: url('some_image.jpg');
    

    do

    background-image: image-url('some_image.jpg');
    

    See http://guides.rubyonrails.org/asset_pipeline.html#css-and-sass for reference

提交回复
热议问题