title: How do I get the base URL (e.g. http://localhost:3000) of my Rails app?
body: <p>I'm using Paperclip to allow users to attach things, and then I'm sending an email and wanting to attach the file to the email.  I'm trying to read the file in and add it as an attachment, like so:</p>
  
  <pre><code># models/touchpoint_mailer.rb
  class TouchpointMailer &lt; ActionMailer::Base
    def notification_email(touchpoint)
      recipients "me@myemail.com"
      from "Touchpoint Customer Portal &lt;portal@touchpointclients.com&gt;"
      content_type "multipart/alternative"
      subject "New Touchpoint Request"
      sent_on Time.now
      body :touchpoint =&gt; touchpoint
  
      # Add any attachments the user has included
      touchpoint.assets.each do |asset|
        attachment :content_type =&gt; asset.file_content_type,
                   :body =&gt; File.read(asset.url)
      end
    end
  end
  </code></pre>
  
  <p>This gives me the following error <code>No such file or directory - /system/files/7/original/image.png?1254497688</code> with the stack trace saying it's the call to <code>File.read</code>.  When I visit the <code>show.html.erb</code> page, and click on the link to the image, which is something like <code>http://localhost:3000/system/files/7/original/image.png?1254497688</code>, the image is displayed fine.</p>
  
  <p>How can I fix this problem?</p>