undefined method `[]' for nil:NilClass
新建 mysql 資料庫時出現問題: $ rake db:create forum_test already exists rake aborted! undefined method `[]' for nil:NilClass 看得出 `test` 環境沒事,加 `RAILS_ENV=production` 測試也 OK,問題只出在 `development`。 再三檢查 `database.yml` 才發現,原來是因為 development 前面,我多打了個 i: idevelopment: 題外話,`RAILS_ENV=production` 若是打成 `RAILS_ENV="production"` 也是不可以的 XD ## Reference * [ruby on rails 3 - rake undefined method `[]' for nil:NilClass - Stack Overflow](http://stackoverflow.com/questions/7623983/rake-undefined-method-for-nilnilclass)
















