title: Rails paperclip static files with absolute url
body: <p>I have a model with one paperclip attachment :image</p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>class HomeScreen &lt; ActiveRecord::Base
    before_create { !HomeScreen.has_record? }
    validates :image, :attachment_presence =&gt; true
    attr_accessible :image
    has_attached_file :image
  
    def self.has_record?
      if HomeScreen.last
        true
      else
        false
      end
    end
  end
  </code></pre>
  
  <p>show method of my conttroller should return image with relative path but json should return absolute url with domain, how can I do that?</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>class HomeScreenController &lt; ApplicationController
    # GET /home_screen
    def show    
      @home_screen = HomeScreen.last
  
      respond_to do |format|
        format.html
        format.json { render json: @home_screen }
      end
    end
  </code></pre>