title: How do I get full URL to an image in a Rails asynchronous mailer?
body: <p>I want to have emails I send out with ActionMailer contain images that link back to my app.  In my development environment, for example:</p>
  
  <pre><code>&lt;img src="http://myfullappurl.dev/assets/myimage.png"&gt;
  </code></pre>
  
  <p>I have this in my development.rb</p>
  
  <pre><code>config.action_controller.asset_host = 'myfullappurl.dev'
  config.action_mailer.asset_host = config.action_controller.asset_host
  config.action_mailer.default_url_options = { host: 'myfullappurl.dev', only_path: false }
  </code></pre>
  
  <p>But I can not get my mail templates to render a full URL in any of these way:</p>
  
  <pre><code>asset_path('myimage.png')
  asset_path('myimage.png', only_path: false)
  image_url('myimage.png')
  </code></pre>
  
  <p>A lot of similar questions on this topic are answered by doing something like this:</p>
  
  <pre><code>"#{request.protocol}#{request.host_with_port}#{asset_path('image.png')}"
  </code></pre>
  
  <p>But because my mails are sent asynchronously with Sidekiq, there is no <code>request</code> object like there would be if they were sent synchronously in a controller.</p>
  
  <p>Is there an obvious thing I am missing, or do I have to fight against Rails to do this?  I am using Rails 4, but I am sure that anything that works in 3.1/3.2 should do just fine.</p>