title: Rails 3 rake task can't find model in production
body: <p>My simple rake task, stored in <code>lib/tasks/items_spider.rake</code> runs just fine in development. All it does is call <code>spider!</code> on the <code>Item</code> model.</p>
  
  <pre><code>namespace :items do
    desc "Spider the web for data, hoorah"
    task :spider =&gt; :environment do
      Item.spider!
    end
  end
  </code></pre>
  
  <p>I have the <code>:environment</code> task as a dependency, so everything works just fine. However, when I add <code>RAILS_ENV=production</code>, I hit errors, both on my local server and the production server:</p>
  
  <pre><code>$ rake items:spider RAILS_ENV=production --trace
  (in /home/matchu/Websites/my-rails-app)
  ** Invoke items:spider (first_time)
  ** Invoke environment (first_time)
  ** Execute environment
  ** Execute items:spider
  rake aborted!
  uninitialized constant Object::Item
  /home/matchu/.rvm/gems/ruby-1.9.2-preview3@rails3/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
  /home/matchu/.rvm/gems/ruby-1.9.2-preview3@rails3/gems/rspec-core-2.0.0.beta.22/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
  /home/matchu/.rvm/gems/ruby-1.9.2-preview3@rails3/gems/rspec-expectations-2.0.0.beta.22/lib/rspec/expectations/backward_compatibility.rb:6:in `const_missing'
  /home/matchu/Websites/openneo-impress-items/lib/tasks/items_spider.rake:4:in `block (2 levels) in &lt;top (required)&gt;'
  /home/matchu/.rvm/gems/ruby-1.9.2-preview3@rails3/gems/rake-0.8.7/lib/rake.rb:636:in `call'
  [...trace of how rake gets to my task...]
  </code></pre>
  
  <p>This just seems odd to me. Apparently the models have not been loaded correctly. I'm on Rails 3.0.3, though development on this app started back when Rails 3 was in beta. How can I go about debugging this issue? Thanks!</p>