title: Rails 4, Mailer preview, preview attached images
body: <p>I have problem with rails 4.1.6 mailer preview.</p>
  
  <p>I want to see attached images in preview mode, but it doesn't work. I think it's incorrect</p>
  
  <p>There is my code:</p>
  
  <p>Mailer file</p>
  
  <pre><code>class AppMailer &lt; ActionMailer::Base
    default from: "robot@mysite.com"
  
    # AppMailer.test_mail.deliver
    def test_mail
      attachments.inline['rails.png'] = File.read(Rails.root.join('app', 'assets', 'images', 'rails.png'))
  
      mail(
        to: 'my-email@gmail.com',
        subject: "test letter",
        template_path: "mailers",
        template_name: "test"
      )
    end
  end
  </code></pre>
  
  <p>Preview file</p>
  
  <pre><code>class MailerPreview &lt; ActionMailer::Preview
    def app_mailer
      AppMailer.test_mail
    end
  end
  </code></pre>
  
  <p>Template file</p>
  
  <pre><code>%p Hello, World!
  %p= image_tag attachments['rails.png'].url
  </code></pre>
  
  <p>When I go to</p>
  
  <pre><code>/rails/mailers/mailer/app_mailer
  </code></pre>
  
  <p>I see preview page, but images doesn't work. There is resulted html code</p>
  
  <pre><code>&lt;p&gt;Hello, World!&lt;/p&gt;
  &lt;p&gt;&lt;img src="cid:544d1354a8aa0_fda8082dbf8258ca@admins-air.mail"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>So. I think, I should to find a way to get path/to/file instead CID in preview mode</p>
  
  <p>(When I sent letter to my mailbox - letter looks fine)</p>
  
  <p>What I am doing wrong in preview mode?</p>