title: Delayed_job (2.1.4) error: Job failed to load: instance of IO needed. Handler nil
body: <p>I created a simplistic achievements system and wanted to introduce delayed_job (2.1.4) to take care of the processing. However, the handler column in the delayed_jobs table is always nil, which results in the last_error text: <code>Job failed to load: instance of IO needed. Handler nil</code></p>
  
  <p>Here is my setup:</p>
  
  <p><strong>Achievement Observer</strong></p>
  
  <pre><code>class AchievementObserver &lt; ActiveRecord::Observer
    observe User, Comment, ...
  
    def after_create(record)
      # initiate delayed job to check conditions
      Delayed::Job.enqueue(TrophyJob.new(record.id, record.class.name))
    end
    ...
  end
  </code></pre>
  
  <p><strong>Trophy Job</strong></p>
  
  <pre><code>class TrophyJob &lt; Struct.new(:record_id, :record_type)
    def perform
      case record_type
      when "User"
        UserProfileCompleteTrophy.progress(User.find(record_id)) # complete your profile settings
        NewsletterReceiverTrophy.progress(User.find(record_id)) # sign up for the newsletter
      when "Comment"
        CommentsAuthoredTrophy.progress(Comment.find(record_id)) # create x comments
      ...
      end
    end
  end
  </code></pre>
  
  <p>The entry in the delayed_jobs table gets created. However, the handler is always NULL. I've already tried various things (passed through complete objects before, now went for id + classname as described here: <a href="https://stackoverflow.com/questions/4688073/weird-exception-with-delayed-job">Weird exception with delayed_job</a>; tried xxxTrophy.delay.progress(...) in the observer; etc.) - all without luck.</p>
  
  <p>I also have</p>
  
  <pre><code>require 'yaml'
  YAML::ENGINE.yamler= 'syck'
  </code></pre>
  
  <p>in my boot.rb.</p>
  
  <p>One thing worth mentioning: Although the last_error text gets filled by delayed_job, the attempts and failed_at columns remain NULL.</p>
  
  <p>What am I missing?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I verified that serialization works as one would expect:</p>
  
  <pre><code>ruby-1.9.2-p290 :004 &gt; TrophyJob.new(1, "User").to_yaml
   =&gt; "--- !ruby/struct:TrophyJob \nrecord_id: 1\nrecord_type: User\n"
  </code></pre>