title: Resetting & reseeding DB using rake task
body: <p>Using the code below to reset &amp; reseed the DB</p>
  <pre><code>task init: [:environment, 'db:migrate:reset', 'db:seed']
  </code></pre>
  <p><code>db:seed</code> creates a few users &amp; few objects. It also updates <code>role</code> for few users.</p>
  <p><code>db:seed</code> throws following error <code>NoMethodError: undefined method 'role' for User</code>.</p>
  <p>There is a migration file which adds <code>role</code> column to <code>User</code> table.</p>
  <p>Unable to resolve this. Tries to write separate task for <code>db:seed</code>. Tried following</p>
  <pre><code>task init: [:environment, 'db:migrate:reset', 'db:seed'] do
    Rake::Task['db:seed'].invoke
  end
  </code></pre>
  <p>Same <code>error</code> as before. Why is <code>column</code> from migration file isn't loaded for <code>db:seed</code> or I am missing something here?</p>
  <p>Error log:</p>
  <pre><code>NoMethodError: undefined method `role' for #&lt;User:0x00007fd5ecb239e0&gt;
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activemodel-6.0.3.2/lib/active_model/attribute_methods.rb:432:in `method_missing'
  /Users/Desktop/rails_app/app/models/user.rb:17:in `update_role'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:428:in `block in make_lambda'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:604:in `catch'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:604:in `block in default_terminator'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:201:in `block in halting'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `block in invoke_before'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `each'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `invoke_before'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:134:in `run_callbacks'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:825:in `_run_validation_callbacks'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activemodel-6.0.3.2/lib/active_model/validations/callbacks.rb:117:in `run_validations!'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activemodel-6.0.3.2/lib/active_model/validations.rb:337:in `valid?'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/validations.rb:68:in `valid?'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/validations.rb:84:in `perform_validations'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/validations.rb:53:in `save!'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:318:in `block in save!'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:212:in `transaction'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/transactions.rb:318:in `save!'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/suppressor.rb:48:in `save!'
  /Users/Desktop/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/persistence.rb:55:in `create!'
  /Users/Desktop/rails_app/app/services/init_data:6:in `process'
  /Users/Desktop/rails_app/db/seeds.rb:3:in `&lt;main&gt;'
  </code></pre>