title: Get full image url from paperclip
body: <p>I'm trying to make an API for an app I'm making and I'm using paperclip gem to upload images to S3. </p>
  
  <p>All has gone fine on the admin side of things but for the api I want to return results as efficiently as possible joining the paperclip image url to each Quiz.</p>
  
  <p>I have an Icon model (this is obviously where paperclip is used) and a Quiz model. A Quiz belongs_to an Icon.</p>
  
  <p>Here is my API method to return all published quizzes</p>
  
  <pre><code>def quizzes
      @quizzes = Quiz.published.joins('INNER JOIN icons ON icons.id = quizzes.icon_id').select('icons.image_file_name, quizzes.updated_at, quizzes.description, quizzes.id, quizzes.title')
  
      respond_to do |format|
          format.json { render :json =&gt; @quizzes }
          format.xml { render :xml =&gt; @quizzes }
      end
  end
  </code></pre>
  
  <p>This only gives me the image name, not the full url to the image eg. only <code>love.png</code> instead of <code>http://s3.amazonaws.com/myapp-dev/icons/images/000/000/001/original/love.png?1342586714</code></p>
  
  <p>How do I get the full url? It's not stored in any of the fields of the Icon model that I can see?</p>
  
  <p>--- EDIT ---</p>
  
  <p>Here is what one of the returned records looks like in xml</p>
  
  <pre><code>&lt;quiz&gt;
    &lt;description&gt;Voluptatem inventore voluptatibus provident et officia. Consequatur voluptate alias. Laboriosam sit et. Non ea aut doloremque odit officiis. Unde mollitia asperiores omnis eaque at.&lt;/description&gt;
    &lt;id type="integer"&gt;5&lt;/id&gt;
    &lt;image-file-name type="NilClass"&gt;love.png&lt;/image-file-name&gt;
    &lt;title&gt;Corrupti ea qui veniam et praesentium.&lt;/title&gt;
    &lt;updated-at type="datetime"&gt;2012-07-21T23:26:48Z&lt;/updated-at&gt;
  &lt;/quiz&gt;
  </code></pre>
  
  <p>Thanks!</p>