Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Rails 4.2控制台问题-使用Rails_ENV=development_Ruby On Rails 4_Devise_Rails Console - Fatal编程技术网

Ruby on rails 4 Rails 4.2控制台问题-使用Rails_ENV=development

Ruby on rails 4 Rails 4.2控制台问题-使用Rails_ENV=development,ruby-on-rails-4,devise,rails-console,Ruby On Rails 4,Devise,Rails Console,试图逃跑 $ 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

试图逃跑

$ 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被设置为false

config/environment/development.rb
  Rails.application.configure do
  config.cache_classes = false
  config.eager_load = false
  …/…
看看我的config/initializers/designe.rb(第13行)

这将导致config/secrets.yml文件

config/secrets.yml
  development:
      domain_name: example.com
这是可以理解的,因为运行rails c(没有rails_ENV),我得到

=>“example.com”

这个警告也很隐晦:

irb:警告:无法从irb_上下文别名上下文

在谷歌搜索中找不到任何信息。。。但至少它是在发展中运行的


为什么使用RAILS\u ENV会出现此警告和错误?欢迎任何启蒙运动

太糟糕了。。我应该读最新的4.2文档!!! 所以我根本不应该使用RAILS_ENV

$rails控制台暂存 加载临时环境(Rails 4.2.3) irb(主):001:0>退出

$rails控制台开发 加载开发环境(Rails 4.2.3) irb:警告:无法从irb_上下文中别名上下文。
irb(主):001:0>退出太糟糕了。。我应该读最新的4.2文档!!! 所以我根本不应该使用RAILS_ENV

$rails控制台暂存 加载临时环境(Rails 4.2.3) irb(主):001:0>退出

$rails控制台开发 加载开发环境(Rails 4.2.3) irb:警告:无法从irb_上下文中别名上下文。 irb(主):001:0>退出

config/secrets.yml
  development:
      domain_name: example.com
$ 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