如何在image-url helper中使用https而不是http来设置网址?
现在:
<%= image_url('logo.png') %> -> http://
我需要这个:
<%= image_url('logo.png') %> -> https://
答案 0 :(得分:1)
您可以创建文件config / initializers / paperclip.rb
Paperclip::Attachment.default_options.merge!( url: ':s3_domain_url', path: ':class/:attachment/:id/:style/:filename', storage: :s3, s3_credentials: Rails.configuration.aws, s3_permissions: :public_read, hash_secret: "", s3_protocol: 'https', default_url: ActionController::Base.helpers.image_path('profile-avatar.jpg') )