title: NoMethodError with Rails app deployed to Heroku (When calling .create on model)
body: <p>I am writing a Ruby on Rails web application to be deployed on Heroku.</p>
  <p>The development database is SQLite and the production database is PostgreSQL.</p>
  <p>Everything works locally in the development and test environments, and worked on Heroku up until the last batch of revisions. Suddenly, attempting to create an instance of the Customer model is throwing</p>
  <pre><code>'NoMethodError undefined method `each' for nil:nilclass'.
  </code></pre>
  <p>The migrations have definitely been run, I have tried pg:reset and re-running migrations, and I have also tried restarting heroku.</p>
  <p>If I open the rails console on heroku and try to call any of the following methods I get the same error</p>
  <p><code>Customer.count</code>
  <code>Customer.create(...)</code>
  <code>Customer.new </code></p>
  <p>Can anyone help resolve this issue?</p>
  <p>EDIT:</p>
  <p>Stacktrace when running rails db:migrate with Postgres DB ( no errors with SQLite )</p>
  <pre><code>** Invoke db:_dump (first_time)
  ** Execute db:_dump
  ** Invoke db:schema:dump (first_time)
  ** Invoke db:load_config
  ** Execute db:schema:dump
  rails aborted!
  NoMethodError: undefined method `each' for nil:NilClass
  /Users/harilimaye/.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'
  /Users/harilimaye/.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'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/enumerable.rb:185:in `sum'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:659:in `sequence_name_from_parts'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:631:in `new_column_from_field'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:115:in `block in columns'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `map'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:112:in `table'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:100:in `block in tables'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:99:in `each'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:99:in `tables'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:44:in `dump'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:28:in `dump'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:377:in `block in dump_schema'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:376:in `open'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:376:in `dump_schema'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:392:in `block (4 levels) in &lt;main&gt;'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:390:in `each'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:390:in `block (3 levels) in &lt;main&gt;'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:97:in `block (2 levels) in &lt;main&gt;'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:88:in `block (2 levels) in &lt;main&gt;'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
  /Users/harilimaye/.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'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
  /Users/harilimaye/.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'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command.rb:48:in `invoke'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `&lt;main&gt;'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
  /Users/harilimaye/Documents/CompSci/Year 2/SEG/smg/alpaca_online_banking/bin/rails:9:in `&lt;top (required)&gt;'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/bin/spring:49:in `&lt;top (required)&gt;'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `&lt;top (required)&gt;'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
  /Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
  /Users/harilimaye/Documents/CompSci/Year 2/SEG/smg/alpaca_online_banking/bin/spring:15:in `&lt;top (required)&gt;'
  bin/rails:3:in `load'
  bin/rails:3:in `&lt;main&gt;'
  </code></pre>