我正在尝试运行轨道(4.1.2
) 安慰
rails c RAILS_ENV=test
我得到这个:
> config.eager_load is set to nil. Please update your
> config/environments/*.rb files accordingly:
>
> * development - set it to false * test - set it to false (unless
> you use a tool that preloads your test environment) * production -
> set it to true
>
> /Users/xxxxxx/.rvm/gems/ruby-2.2.2/gems/activerecord-4.1.12/lib/active_record/connection_adapters/connection_specification.rb:257:in
> `resolve_symbol_connection': 'RAILS_ENV=test' database is not
> configured. Available: ["development", "test", "production"]
> (ActiveRecord::AdapterNotSpecified)
然而在我的test.rb
I have config.eager_load = false
and my database.yml
没问题(我跑了rake db:schema:load RAILS_ENV=test
没有问题。
我该如何解决这个问题?
您需要在运行命令之前声明环境:
RAILS_ENV=test bundle exec rails c
我在我的计算机上得到相同的输出:
> bundle exec rails c RAILS_ENV=test ian@Ians-MacBook-Pro
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
但是当我按照建议运行时:
> RAILS_ENV=test bundle exec rails c ian@Ians-MacBook-Pro
Loading test environment (Rails 4.2.3)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)