title: ActiveStorage service_url && rails_blob_path cannot generate full url when not using S3
body: <p>I have a basic ActiveStorage setup with one model that <code>has_many_attached :file_attachments</code>.  In a service elsewhere I'm trying to generate a link to be used outside the main app (email, job etc).  </p>
  
  <p>With S3 in production I can do:
  <code>item.file_attachments.first.service_url</code> and I get an appropriate link to the S3 bucket+object.</p>
  
  <p>I cannot use the method prescribed in the rails guides: <code>Rails.application.routes.url_helpers.rails_blob_path(item.file_attachments.first)</code></p>
  
  <p>It errors with:
  <code>ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true</code>
  I can pass it a <code>host: 'http://....'</code> argument and it's happy although it still doesn't generate the full URL, just the path.</p>
  
  <p><strong>In development</strong> I'm using disk backed file storage and I can't use either method:</p>
  
  <pre><code>&gt; Rails.application.routes.url_helpers.rails_blob_path(item.file_attachments.first)
  ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
  </code></pre>
  
  <p>Setting host here also doesn't generate a full URL.</p>
  
  <p>In production <code>service_url</code> works, however here in development I get the error:</p>
  
  <pre><code>&gt; item.file_attachments.first.service_url
  ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
  </code></pre>
  
  <p>and specifying a host doesn't help:</p>
  
  <pre><code>item.file_attachments.first.service_url(host:'http://localhost.com')
  ArgumentError: unknown keyword: host
  </code></pre>
  
  <p>I've also tried adding </p>
  
  <pre><code>config.action_mailer.default_url_options = { :host =&gt; "localhost:3000" }
  config.action_storage.default_url_options = { :host =&gt; "localhost:3000" }
  Rails.application.routes.default_url_options[:host] = 'localhost:3000'
  </code></pre>
  
  <p>with no success.</p>
  
  <p>My question is - <strong>how can I get the full URL in a manner that works in both development and production?</strong> or where do I set the host at?</p>