title: Posting a photo to the Facebook Open Graph from Heroku, using RoR, FbGraph Gem, and S3
body: <p>I am trying to allow a user to share a photo on his Facebook wall. I use Paperclip to store all of my app's photos on S3. So in the below example @photo.image.url is the S3 url of an image that I want to post in some_album. Using the fb_graph gem this is relatively easy on localhost. In my controller I have:</p>
  
  <pre><code>    the_photo = open(@photo.image.url)
      some_album.photo!(
        :access_token =&gt; access_token,
        :source =&gt; the_photo
      )
  </code></pre>
  
  <p>the_photo's class on localhost is "Tempfile". </p>
  
  <p>On heroku things get tricky. Using the same code two (seemingly related) things happen. First, the_photo is class type "stringIO". Second when FbGraph posts to Facebook I get the following error:</p>
  
  <pre><code>FbGraph::InvalidRequest (OAuthException :: (#324) Requires upload file):
  </code></pre>
  
  <p>Heres a few bullet points of facts that might also help:</p>
  
  <ul>
  <li>Heroku is a read only system, but apparently you <em>can</em> write to a Tempfile</li>
  <li>I am on Rails 3.1.0</li>
  <li>Ruby 1.9.2</li>
  <li>Heroku Stack Bamboo-Miri</li>
  </ul>
  
  <p>Any help/thoughts/work arounds/questions would be greatly appreciated.</p>