Almost a year ago I wrote about integrating Scribd into your Rails application, and since then that feature has been working well in my applicant tracking system. Today, though, I got a request for information on how I display the documents that I send to Scribd, so I thought I'd share that, too.
In the previous post I showed how to send the document to Scribd using the API, and in this post I'll show how I take the results from the API and use them in my application. First, here's a snippet from my Attachment model that shows I create Scribd URLs based on the info that comes back from the API. The scribd_access_key and scribd_doc_id are database-backed methods whose values get populated with the response from the API. The scribd_url method is defined like so, simply creating a link to Scribd using the document ID and access key:
Here's a snippet from my view that shows the attachments related to a job candidate's submission. The preview link is conditional on the Scribd document ID being set, since not all documents that could be attached (e.g., resumes in WordPerfect format) will be successfully converted by Scribd. The user still gets a download link though.