title: Job failed to load: uninitialized constant with Delayed Job and Rails 3
body: <p>I'm trying to utilize Delayed Job in my Rails 3 app, but keep hitting a snag. The jobs keep failing with the error: <code>Job failed to load: uninitialized constant CrawlJob.</code></p>
  
  <p>I found a couple of other SO threads and followed advice there to no avail. Here is the relevant code.</p>
  
  <p><strong>Application.rb</strong></p>
  
  <pre><code>require File.expand_path('../boot', __FILE__)
  
  require 'rails/all'
  </code></pre>
  
  <p>...</p>
  
  <pre><code>module Decurate
    class Application &lt; Rails::Application
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    config.autoload_paths += %W(#{config.root}/lib)
      config.autoload_paths += Dir["#{config.root}/lib/**/"]
  </code></pre>
  
  <p>...</p>
  
  <pre><code>  end
  end
  </code></pre>
  
  <p><strong>/lib/crawl_job.rb</strong></p>
  
  <pre><code>class CrawlJob &lt; Struct.new(:merchant_id,:ec2,:s3)
    def perform
  </code></pre>
  
  <p>...</p>
  
  <pre><code>  end
  end
  </code></pre>
  
  <p><strong>/lib/tasks/cron.rake</strong></p>
  
  <pre><code>  merchants = Store.all.collect{ |store| store[:merchant_id] }
    merchants.each do |merchant_id|
      queue.push merchant_id
    end
    merchants.each do |merchant_id|
      Delayed::Job.enqueue CrawlJob.new(merchant_id,@ec2,@s3)
    end
  </code></pre>