耙子中止未定义的方法“每个”
Posted
技术标签:
【中文标题】耙子中止未定义的方法“每个”【英文标题】:Rake aborted undefined method `each' 【发布时间】:2015-12-04 09:43:19 【问题描述】:下午好。 无法处理癌症数据库:迁移
user@ubuntu:~/furriery/furriery$ rake db:migrate
耙中止!
未定义的方法each' for "../.openshift/config/database.yml":String
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.4/lib/active_record/connection_adapters/connection_specification.rb:163:in
resolve_all'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:69:in resolve'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.4/lib/active_record/core.rb:46:in
configurations='
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.4/lib/active_record/railtie.rb:128:in block (2 levels) in <class:Railtie>'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in
instance_eval'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in execute_hook'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:28:in
block in on_load'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in each'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in
on_load'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.1.4/lib/active_record/railtie.rb:118:in block in <class:Railtie>'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/initializable.rb:30:in
instance_exec'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/initializable.rb:30:in run'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/initializable.rb:55:in
block in run_initializers'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/initializable.rb:54:in run_initializers'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/application.rb:300:in
initialize!
/home/user/furriery/furriery/config/environment.rb:5:in <top (required)>'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in
require'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in block in require'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in
load_dependency'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require'
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/application.rb:276:in
require_environment!
/home/user/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.1.4/lib/rails/application.rb:379:in block in run_tasks_blocks'
/home/user/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in
eval'
/home/user/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `'
任务:TOP => db:migrate => 环境
(通过使用 --trace 运行任务查看完整跟踪)
ruby 2.0.0p643(2015-02-25 修订版 49749)[i686-linux] 导轨 4.1.4 rvm 1.26.11(最新)作者 Wayne E. Seguin,Michal Papis [https://rvm.io/]
【问题讨论】:
【参考方案1】:检查您的 database.yml 文件并确保每个“:”分隔符后跟一个空格。还要确保你有空格,而不是制表符,用于缩进。您可以在此处检查您的文件是否是有效的 YAML:http://www.yamllint.com/
【讨论】:
网站yamllint.com检查文件.yml 在线宣誓 (以上是关于耙子中止未定义的方法“每个”的主要内容,如果未能解决你的问题,请参考以下文章
Rake 正在中止,因为 sqlite db 的未定义方法“inet”
Rails 类给出 NoMethodError 未定义的方法“每个”