Turbolinks with carrierwave images as CSS background-image

前端 未结 1 862
鱼传尺愫
鱼传尺愫 2021-02-13 19:41

I\'ve been using turbolinks along this year but lately I\'m getting this annoying bug. Images uploaded via carrierwave are loaded in the site with absolute URL\'s in the first r

相关标签:
1条回答
  • 2021-02-13 20:21

    I just figured out that if you use absolute url's for background images the bug dessapears. So this is how I call carrierwave images in my helper:

    img = ProductImage.find(id) 
    "#{request.protocol}#{request.host_with_port}#{img.photo}"
    

    photo is the attribute used with carrierwave uploader.

    0 讨论(0)
提交回复
热议问题