title: Why is my custom rake task in lib/tasks not discovered in Rails 3?
body: <p>Build-in rake tasks work fine, but my new custom one, in Project/lib/tasks/payments.rb doesn't get loaded:</p>
  
  <pre><code>namespace :payments  do
    desc "Tally payments at the end of the month"
    task :compute =&gt; :environment do
      BillingPeriod.compute_new_period
    end
  end
  
  $ rake payments:compute
  (in /Users/rob/Code/Apps/skyfarm)
  rake aborted!
  Don't know how to build task 'payments:compute'
  </code></pre>
  
  <p>It works fine if I load the file application.rb:</p>
  
  <pre><code>require 'lib/tasks/payments.rb'
  </code></pre>
  
  <p>...but it breaks other things:</p>
  
  <pre><code>$ rails s
  ./lib/tasks/payments.rb:1: undefined method `namespace' for main:Object (NoMethodError)
  </code></pre>