代码之家  ›  专栏  ›  技术社区  ›  Messias Tayllan

开始使用变量后,活动存储不在本地主机上工作

  •  0
  • Messias Tayllan  · 技术社区  · 5 年前

    使用 :local 因为本地主机中的存储不起作用。 我得到以下错误

    Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
    

    调用个人资料图片的代码

    def profile_picture
      picture = if self.image.attached? then self.image else Config.first.default_profile end
      picture.variant(combine_options: { resize: "100x100>", gravity: 'Center', extent: "100x100", background: 'white'}).processed.service_url
    end
    

    <%= image_tag current_admin.profile_picture, class: 'rounded-circle img-sidebar' %>
    

    我已经试着

    Rails.application.routes.default_url_options[:host] = "localhost"
    

    当我将活动存储服务更改为google时,在localhost中工作得很好。

    0 回复  |  直到 5 年前
    推荐文章