ActiveMailer PDF Email Attachments with Paperclip

Let’s say we have a Report model, which has PDFs as Paperclip attachments: # /app/models/report.rb class Report < ActiveRecord::Base belongs_to :user has_attached_file :pdf validates_attachment :pdf, content_type: { content_type: "application/pdf »

Socket Timeouts in Ruby

I recently had a problem, which required me to close an open HTTP connection if it had not received any new data for a certain amount of time. After a bit of Googling, I found that the Timeout module baked into Ruby was probably not my best option. I »

Ruby LoadError: cannot load such file

So, you’ve just upgraded your Ruby app to Ruby 1.9.2, 1.9.3, 2.0.0, or greater, and you’re hit with: LoadError: cannot load such file -- somefile Your code will most likely look something like this: require 'my-ruby-code' require 'some-gem' ... »