views:

479

answers:

2

Working with rails for the first time and I getting a rake error when I try:
rake db:migrate RAILS_ENV=staging

The Error:
(in [my current directory]) rake aborted! undefined method `symbolize_keys' for nil:NilClass

Has anyone seen this?

A: 

The error is most likely occurring when your config yaml files are being loaded and it is trying to find a staging configuration that is not there. (It is trying tosymbolize the keys for staging environment, but since they are not there it is attempting to symbolize nil) Check your yaml files in the config directory to see if you are missing a staging configuration. Once you add that, everything should work.

Hope that helps.

lillq
A: 

I had this same problem today. I forgot to add 'staging' to my yaml config file. It had dev/test/prod... but I overlooked staging.

e.g. config/initializers/app_config.rb APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/app_config.yml")[RAILS_ENV].symbolize_keys

David P Thomas