title: RAILS_ENV=dev bundle exec rake db:seed not working
body: <p>I have written this code</p>
  
  <pre><code>namespace :db do
    task :seed, :only =&gt; {:primary =&gt; true}, :except =&gt; { :no_release =&gt; true } do 
      rails_env = ENV["RAILS_ENV"]
      current_path = File.dirname(__FILE__)
      run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:seed"
    end
  end
  </code></pre>
  
  <p>and I am calling db.seed after deploy:migrate</p>
  
  <p>This code is working on my test environment but not on dev or integration environment.
  Its showing this error : </p>
  
  <pre><code>rake aborted!
  undefined method `[]' for nil:NilClass
  /Users/Megha/Documents/Mckinsey project/LeanITAppServer/config/initializers/authentication.rb:6:in `&lt;top (required)&gt;'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in &lt;class:Engine&gt;'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in &lt;class:Engine&gt;'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /Users/Megha/Documents/Mckinsey project/LeanITAppServer/config/environment.rb:6:in `&lt;top (required)&gt;'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/application.rb:103:in `require'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:346:in `block (2 levels) in &lt;top (required)&gt;'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/bin/ruby_noexec_wrapper:14:in `eval'
  /Users/Megha/.rvm/gems/ruby-1.9.3-p392@bto/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;'
  Tasks: TOP =&gt; db:abort_if_pending_migrations =&gt; environment
  </code></pre>
  
  <p>Can anyone tell me what's the problem</p>