main:Object 的未定义局部变量或方法“config”(NameError)

undefined local variable or method `config' for main:Object (NameError)

我正在编写一个 rails 应用程序,我正在尝试使用 Devise. Following the setup instructions here,我正在尝试使用 rails generate devise:install,但我不断收到此错误:

~/projects/readone/config/application.rb:8:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError)

我尝试了不同的方法,如卸载、重新安装 gem 等。我还在 Google 和 Stack Overflow 的其他地方发现了一些类似的错误,但其中 none专门处理此 undefined local variable or method `config' 错误。

我将在下面包含完整的错误。知道会发生什么吗?

~/readone/config/application.rb:8:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError)
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:82:in `require'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:82:in `preload'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:143:in `serve'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /~/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /~/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'

发现问题:我的配置中有一行显示 config.force_ssl = true。将其注释掉并且有效!考虑过删除我的问题,但认为也许其他人可能会 运行 解决这个问题。 –