RailsCasts Pro episodes are now free!

Learn more or hide this

otagi's Profile

GitHub User: otagi

Comments by otagi

Avatar

I'm using this to insert an S3 image into a table cell:

ruby
class CustomPdf < Prawn::Document
  require 'open-uri'

  def image_cell(image_url)
    {image: open(image_url), fit: [IMAGE_SIZE, IMAGE_SIZE], position: :center}
  rescue SocketError
    ""
  end
end

Then just call image_cell in your table data array: [ [ image_cell(url), ... ], [ ... ] ].

Avatar

You are correct, Heroku requires a separate worker dyno to launch background jobs.

You can use the Workless gem, which creates and kills a worker when DelayedJob is called. Heroku will only bill you the uptime ($0.05/h), not the full $35/m.

Avatar

Great screencast as always.

Confirmation boxes are still useful, though. Undoing changes on a model with a Paperclip attachment is less trivial.