Rails missing image

前端 未结 1 1371
终归单人心
终归单人心 2021-02-18 17:17

I am currently using paperclip to upload images to my rails app. This is probably a very simple fix but how or where do I save the missing images to? This is the error that is p

1条回答
  •  南方客
    南方客 (楼主)
    2021-02-18 17:59

    If you don't need any control over the default image, which I don't think you need, you can place it in any folder under RAILS_ROOT/public/images/

    Just make sure you point it out in the attachment model with the :default_url parameter. So for example if you place the image in RAILS_ROOT/public/images/normal/missing.png you need t specify the path like this:

    has_attached_file :photo, :default_url => "/images/normal/missing.png"
    

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