title: rake undefined method `[]' for nil:NilClass
body: <p>I just installed a Rails 3.1 app to my deployment server.</p>
  
  <p>When I tried to run</p>
  
  <pre><code>sudo rake db:setup RAILS_ENV=“production”
  </code></pre>
  
  <p>I got an error message saying  </p>
  
  <pre><code>rake aborted!
  undefined method `[]' for nil:NilClass
  </code></pre>
  
  <p>With --trace it says:  </p>
  
  <pre><code>** Invoke db:setup (first_time)  
  ** Invoke db:create (first_time)  
  ** Invoke db:load_config (first_time)  
  ** Invoke rails_env (first_time)  
  ** Execute rails_env  
  ** Execute db:load_config  
  ** Execute db:create  
  rake aborted!  
  undefined method '[]' for nil:NilClass  
  /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:74:in 'rescue in create_database'  
  /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:54:in 'create_database'  
  /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:44:in 'block (2 levels) in &lt;top (required)&gt;'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in 'call'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in 'block in execute'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in 'each'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in 'execute'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in 'block in invoke_with_call_chain'  
  /usr/local/lib/ruby/1.9.1/monitor.rb:201:in 'mon_synchronize'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in 'invoke_with_call_chain'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in 'block in invoke_prerequisites'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in 'each'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in 'invoke_prerequisites'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:in 'block in invoke_with_call_chain'  
  /usr/local/lib/ruby/1.9.1/monitor.rb:201:in 'mon_synchronize'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in 'invoke_with_call_chain'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in 'invoke'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in 'invoke_task'    
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in 'block (2 levels) in top_level'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in 'each'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in 'block in top_level'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in 'standard_exception_handling'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in 'top_level'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in 'block in run'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in 'standard_exception_handling'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in 'run'  
  /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in '&lt;top (required)&gt;'  
  /usr/local/bin/rake:19:in 'load'  
  /usr/local/bin/rake:19:in '&lt;main&gt;'  
  Tasks: TOP =&gt; db:setup =&gt; db:create  
  </code></pre>
  
  <p>My database.yml says  </p>
  
  <pre><code>production:
  adapter: mysql2  
      encoding: utf8  
      reconnect: false  
      database: t_production  
      pool: 5  
      username: deploy  
      password: V  
      host: localhost  
  </code></pre>
  
  <p>There is only 1 migration and it says this:  </p>
  
  <pre><code>    class CreateDeals &lt; ActiveRecord::Migration  
    def change  
      create_table :deals do |t|  
        t.string :title  
        t.text :description  
        t.string :image_url  
        t.decimal :price, :precision =&gt; 8, :scale =&gt; 2  
  t.timestamps  
      end  
    end  
  end  
  </code></pre>
  
  <p>What should I try to fix this? I'm not even sure where to begin.</p>