Rails 5, “nil is not a valid asset source”

后端 未结 4 2043
暗喜
暗喜 2021-02-12 09:56

I have just upgraded to Rails 5 and I have a weird issue while trying to show an image.

I have the exact code I had for Rails 4:

<%= image_tag article         


        
4条回答
  •  旧时难觅i
    2021-02-12 10:07

    I don't know this is compact solution or not but this code will work.

    activate the fallback method in your uploader.

      def default_url
        "/assets/fallback/" + [version_name, "default.png"].compact.join('_')
      end
    

    Hope this will help you.

    Cheers (y)

提交回复
热议问题