新手问题 使用 ActiveStorage . rails c 调用 seviec_url 报错 设置 default_url_options

sunjirui · September 22, 2018 · Last by sunjirui replied at September 26, 2018 · 920 hits

报错内容:Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 没找着在哪里设置 default_url_options

这个方法对 local storage 不太友好,用这个方法:

Rails.application.routes.url_helpers.rails_blob_path(user.avatar, only_path: true)

https://guides.rubyonrails.org/active_storage_overview.html#linking-to-files

Reply to Rei

谢谢!

sunjirui closed this topic. 26 Sep 13:45
You need to Sign in before reply, if you don't have an account, please Sign up first.