0

我逐步将 rails 4.2.10 升级到 6.0。但是,当我尝试将 rails 5.2.4.4 升级到 6.0 时,我无法查询,因为Object.all它为 nil:NilClass错误提供了未定义的方法“每个” 。当我尝试调用Object它时,它给了我未定义的方法“包括?” 对于 nil:NilClass。即使我无法运行它在运行后创建的活动存储的迁移文件,rails active_storage:update我也不明白出了什么问题,我也没有看到任何人生活在同样的事情上。

Started GET "/" for 127.0.0.1 at 2020-12-15 16:48:40 +0300
   (2.4ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Started GET "/tr" for 127.0.0.1 at 2020-12-15 16:48:41 +0300
Processing by WelcomeController#homepage as HTML
  Parameters: {"locale"=>"tr"}
Completed 500 Internal Server Error in 51ms (ActiveRecord: 4.0ms | Allocations: 13240)



NoMethodError - undefined method `each' for nil:NilClass:
  app/controllers/application_controller.rb:92:in `set_locale'
89-      @footer_categories = Category.where(id: ft_cate_ids).order('order_number DESC')
90-      @posts_footer = PostBlog.where(status: 1).order('id DESC').limit(3)
91-    elsif Rails.env.development?
92-      @posts_footer = PostBlog.where(status: 1).order('id DESC').limit(3)
93-    end

这个是请求错误和没有迁移的代码


➜  upgrade git:(upgrade) ✗ rails db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
== 20201215113528 AddServiceNameToActiveStorageBlobs: migrating ===============
-- column_exists?(:active_storage_blobs, :service_name)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `each' for nil:NilClass
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:37:in `to_array'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:8:in `convert'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/sum.rb:3:in `sum'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/core_ext/enumerable.rb:246:in `sum'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql/schema_statements.rb:691:in `sequence_name_from_parts'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql/schema_statements.rb:663:in `new_column_from_field'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `block in columns'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `map'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `columns'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:144:in `column_exists?'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:929:in `block in method_missing'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:897:in `block in say_with_time'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:293:in `measure'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:897:in `say_with_time'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:918:in `method_missing'
/home/mesabuca/Workspace/upgrade/db/migrate/20201215113528_add_service_name_to_active_storage_blobs.active_storage.rb:4:in `up'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:870:in `public_send'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:870:in `exec_migration'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:293:in `measure'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:850:in `block in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:849:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1037:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/transactions.rb:209:in `transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1380:in `ddl_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1302:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1251:in `block in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1251:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1086:in `up'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1061:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:90:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_module.rb:59:in `with_application'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/command.rb:52:in `invoke'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'

Caused by:
NoMethodError: undefined method `each' for nil:NilClass
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:37:in `to_array'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:8:in `convert'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/sum.rb:3:in `sum'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/core_ext/enumerable.rb:246:in `sum'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql/schema_statements.rb:691:in `sequence_name_from_parts'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql/schema_statements.rb:663:in `new_column_from_field'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `block in columns'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `map'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `columns'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:144:in `column_exists?'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:929:in `block in method_missing'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:897:in `block in say_with_time'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:293:in `measure'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:897:in `say_with_time'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:918:in `method_missing'
/home/mesabuca/Workspace/upgrade/db/migrate/20201215113528_add_service_name_to_active_storage_blobs.active_storage.rb:4:in `up'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:870:in `public_send'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:870:in `exec_migration'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:293:in `measure'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:850:in `block in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:849:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1037:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.1.0/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/transactions.rb:209:in `transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1380:in `ddl_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1302:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1251:in `block in migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1251:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1086:in `up'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/migration.rb:1061:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:90:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_module.rb:59:in `with_application'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/command.rb:52:in `invoke'
/home/mesabuca/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.1.0/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate

这是一个带有回溯的迁移错误。

4

1 回答 1

0

您的错误消息表明问题出在descriptive_statistics(第三方)gem 上。我在项目的 github 页面中发现了这个问题——这似乎正是你的问题。

似乎这个问题与 Rails 升级无关,而是将 ruby​​ 升级到2.4+

正如github问题上所建议的那样,您可以通过以下方式解决它:

# Add require: false in your Gemfile:
gem 'descriptive_statistics', require: false

# explicitly require the library, and extend arrays where needed in your code:
require 'descriptive_statistics/safe'

data = []
data.extend(DescriptiveStatistics)
data.sum
于 2020-12-16T12:40:11.073 回答