1
試圖運行的Rails 4.2控制檯的問題 - 使用RAILS_ENV =發展
$ rails c RAILS_ENV=development
1警告和1個錯誤被提升,我不明白
# warning :
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
# error
/config/initializers/devise.rb:13:in `+': no implicit conversion of nil into String (TypeError)
然而,config.eager_load設爲假的在開發環境
config/environment/development.rb
Rails.application.configure do
config.cache_classes = false
config.eager_load = false
…/…
並看着config/initializers/devise.rb(第13行)我有
config/initializers/devise.rb
Devise.setup do |config|
…/…
(13) config.mailer_sender = '[email protected]' + Rails.application.secrets.domain_name
…/…
這會導致配置/ secrets.yml文件
config/secrets.yml
development:
domain_name: example.com
這是完全可以理解的,因爲運行的軌道C(RAILS_ENV內部消除),我得到
$ rails c
development environment (Rails 4.2.3)
irb: warn: can't alias context from irb_context.
irb(main):001:0> Rails.application.secrets.domain_name
=>「的例子.com「
這個警告也是神祕的:
IRB:警告:可以從非別名上下文irb_context
找不到在谷歌搜索任何信息......但至少它在開發運行....
爲什麼這個警告和錯誤使用RAILS_ENV?任何啓蒙的歡迎