Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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 Rails错误消息显示太多细节_Ruby On Rails - Fatal编程技术网

Ruby on rails Rails错误消息显示太多细节

Ruby on rails Rails错误消息显示太多细节,ruby-on-rails,Ruby On Rails,我是一名编程新兵训练营的学生,正在努力学习Rails和TDD。我问过我的教授,但不幸的是,他们说他们不确定发生了什么,并建议我继续努力。。。我来Stackoverflow看看这是不是以前发生过的事情 我的问题是:每当rails生成错误时,无论是来自RSpec还是通用rails,它都包含了大量额外的细节,这最多只能让故障排除和TDD变得单调乏味。由于缺乏更好的术语,当出现错误时,它会识别导致错误显示的所有验证,而不是仅仅说明错误所在。例如当我运行迁移时(我故意添加了一个“s”来创建一个名称错误),

我是一名编程新兵训练营的学生,正在努力学习Rails和TDD。我问过我的教授,但不幸的是,他们说他们不确定发生了什么,并建议我继续努力。。。我来Stackoverflow看看这是不是以前发生过的事情

我的问题是:每当rails生成错误时,无论是来自RSpec还是通用rails,它都包含了大量额外的细节,这最多只能让故障排除和TDD变得单调乏味。由于缺乏更好的术语,当出现错误时,它会识别导致错误显示的所有验证,而不是仅仅说明错误所在。例如当我运行迁移时(我故意添加了一个“s”来创建一个名称错误),我得到了下面的输出。不管发生什么错误,都会生成类似的内容

/Users/josephhaas/turing_mod_2/ic/b2-challenges main $rails db:migrate
== 20210405151910 CreateMechanics: migrating ==================================
-- create_table(:mechanics)
   -> 0.0122s
== 20210405151910 CreateMechanics: migrated (0.0122s) =========================

== 20210405151951 CreateRides: migrating ======================================
-- create_table(:rides)
   -> 0.0046s
== 20210405151951 CreateRides: migrated (0.0047s) =============================

rails aborted!
NameError: uninitialized constant CreateMechanicsRides
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:283:in `const_get'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:283:in `block in constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `each'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `inject'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:987:in `load_migration'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:982:in `migration'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:977:in `disable_ddl_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1350:in `use_transaction?'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1297:in `rescue in execute_migration_in_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1285:in `execute_migration_in_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in `each'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in `block in migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1036:in `up'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1011:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/command.rb:48:in `invoke'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands.rb:18:in `<top (required)>'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:4:in `<main>'

Caused by:
NameError: uninitialized constant CreateMechanicsRides
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:283:in `const_get'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:283:in `block in constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `each'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `inject'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/inflector/methods.rb:281:in `constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:987:in `load_migration'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:982:in `migration'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:977:in `disable_ddl_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1350:in `use_transaction?'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1342:in `ddl_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in `each'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in `block in migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1036:in `up'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1011:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/command.rb:48:in `invoke'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands.rb:18:in `<top (required)>'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/josephhaas/turing_mod_2/ic/b2-challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)```
/Users/josephhaas/turing_mod_2/ic/b2挑战main$rails db:migrate
==20210405151910 CreateMechanics:迁移==================================
--创建表格(:力学)
->0.0122s
==20210405151910 CreateMechanics:已迁移(0.0122s)=========================
==20210405151951 CreateRides:迁移======================================
--创建_表(:游乐设施)
->0.0046s
==20210405151951 CreateRides:已迁移(0.0047s)=============================
rails中止了!
NameError:未初始化的常量CreateMechanicsRides
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/influctor/methods.rb:283:in'const_get'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/indlector/methods.rb:283:in'block in constantize'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/influctor/methods.rb:281:in'each'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/influctor/methods.rb:281:in'inject'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/indlector/methods.rb:281:in'constantize'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.5/lib/active_support/core_ext/string/influctions.rb:68:in'constantize'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:987:in'load_migration'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:982:in“migration”
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:977:in'disable_ddl_transaction'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1350:在“使用交易”中
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1297:in `执行迁移中的救援`事务中
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1285:in“execute_migration_in_transaction”
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1263:in'block in migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in'each'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1262:in'migrate_without_lock'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in'block in migrate'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1363:in'with_advision_lock'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1210:in'migrate'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1036:in'up'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/migration.rb:1011:in'migrate'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/tasks/database_tasks.rb:172:在“迁移”中
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.5/lib/active_record/railties/databases.rake:60:in'block(2层)in'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:23:in'block in perform'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands/rake/rake_command.rb:20:in'perform'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/command.rb:48:in'invoke'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/railties-5.2.5/lib/rails/commands.rb:18:in`'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in'require'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in`block in require_with_bootsnap_lfi'
/Users/josephhaas/turing_mod_2/ic/b2 challenges/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in'register'
/用户/josephhaas/turing_mod_2/ic/b2挑战/vendo