danwoods
danwoods

Reputation: 4907

rake db:migrate throws undefined method 'symbolize_keys' for nil:NilClass

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?

Upvotes: 1

Views: 7984

Answers (3)

Weston Ganger
Weston Ganger

Reputation: 6712

In rails 3.2 make sure you have a section for staging or whatever your enviroment name is in config/settings.yml

Upvotes: 0

David P Thomas
David P Thomas

Reputation: 111

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

Upvotes: 4

lillq
lillq

Reputation: 15389

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.

Upvotes: 0

Related Questions