title: Generate image URL in model - ActiveStorage
body: <p>I have a simple model using ActiveStorage (Rails 5.2.0.rc2), the model looks like this:</p>
  
  <pre><code>class Vacancy &lt; ApplicationRecord
    has_one_attached :image
  
    validates_presence_of :title
  
    def to_builder
      Jbuilder.new do |vacancy|
        vacancy.call(self, :id, :title, :description, :created_at, :updated_at)
        vacancy.image do
          vacancy.url image.attached? ? Rails.application.routes.url_helpers.url_for(image) : nil
        end
      end
    end
  end
  </code></pre>
  
  <p>Then in the <code>to_builder</code> method I want to show the permanent URL for the image, I'm trying with <code>Rails.application.routes.url_helpers.url_for(image)</code> as suggested in the rails guides (<a href="http://edgeguides.rubyonrails.org/active_storage_overview.html#linking-to-files" rel="noreferrer">http://edgeguides.rubyonrails.org/active_storage_overview.html#linking-to-files</a>) but it raises this error:</p>
  
  <p><code>Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true</code></p>
  
  <p>In my application I already have the <code>default_url_options[:host]</code> set but it doesn't work, even writing <code>url_for(image, host: 'www.example.com')</code> or <code>url_for(image, only_path: true)</code> doesn't work either as it raises another error: <code>wrong number of arguments (given 2, expected 1)</code></p>
  
  <p>What is the correct way to show the permanent URL in the model scope using activestorage? </p>