Skip to content

Parperclip default _url 的設定

lululala edited this page Feb 3, 2017 · 2 revisions

ActionController::Base.helpers.asset_path('no-company-logo.png') 某種原因這個會被過濾掉會失效

  has_attached_file :logo, styles: {thumb: '200x200#', micro: '35x35#'},
                           default_url: ->(attachment) { ActionController::Base.helpers.asset_path('no-company-logo.png') }

只要把asset_path()內的照片換成你要的即可