Undefined method completed_at even after creating db:migrate file
I have the same situation as Harrison Hondo had. When doing the migrate it did not show that the column was created like it did for Jason in the video. If I run db:migrate again, I get nothing returned. How do I make this work? Do I revert to the previous commit and start over? Can I just delete the migration file and create a new one? I am not sure what to do. Here is the error I am getting when I run rspec:
1) Completing todo items is successful when marking a single item complete
Failure/Error: expect(todo_item.completed_at).to be_nil
completed_at' for #<TodoItem:0x5f9a408>
# ./spec/features/todo_items/complete_spec.rb:8:inblock (2 levels) in <top (required)>'
Finished in 0.08 seconds 1 example, 1 failure
rspec ./spec/features/todo_items/complete_spec.rb:7 # Completing todo items is successful when marki ng a single item complete
Seth Reece32,864 Points
You can try
rake db:rollback then change your migration, then migrate. You can also run
rails generate migration AddSomeColumnToAndExistingTable then migrate again once you have the proper column information in your file that was created.
There is more about this in the documentation.
Thanks so much, Seth! The db:rollback worked. I had to roll back both migrations, the db:migrate and the db:migrate RAILS_ENV=test. I ran the rspec on complete_spec.rb and it came up with the correct result. Thanks, again!