Active-record error after rails upgrade undefined method `each' for nil:NilClass and undefined method `include?' for nil:NilClass

1.6k views Asked by At

I upgrade rails 4.2.10 to 6.0 step by step. But when I try to upgrade rails 5.2.4.4 to 6.0 I cant query like Object.all it gives me undefined method 'each' for nil:NilClass error. When I try to call Object it gives me undefined method 'include?' for nil:NilClass. Even I cant run active storage's migration files which it creates after running rails active_storage:update I didn't understand what is wrong and I didn't see anybody who lived same thing.

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

This one is the request error and the code without migrations


➜  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

This one is migrating error with backtrace.

1

There are 1 answers

1
Tom Lord On BEST ANSWER

Your error message shows that the problem lies in the descriptive_statistics (third party) gem. I found this issue in the project's github page -- which appears to be exactly your problem.

It also appears the issue has got nothing to do with rails upgrading, but rather, upgrading ruby to 2.4+

As suggested on the github issue, you can resolve it by doing:

# 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