I'm doing chapter 10 of enter link description here. I got the same error mentioned in enter link description here
PasswordResetsTest#test_password_resets:
NoMethodError: undefined method `reset_sent_at=' for #<User:0xccd47c0>
app/models/user.rb:66:in `create_reset_digest'
app/controllers/password_resets_controller.rb:12:in `create'
test/integration/password_resets_test.rb:17:in `block in <class:PasswordResetsTest>'
I try to do everything mentioned in the answer. first thing I did was:
rails generate migration add_reset_to_users reset_digest:string reset_sent_at:datetime
and the answer was:
Another migration is already named add_reset_to_users:
so I'm sure I did the migration before. This _add_reset_to_users.rb file in migrate folder.
class AddResetToUsers < ActiveRecord::Migration
def change
add_column :users, :reset_digest, :string
end
end
Then I try to restart my rails server.(I'm not sure if I'm doing it right) using
rails server
and then shutting down the server. Non of them worked. I'm still getting the same error.
Another migration is already named add_reset_to_users:
You had already created the migration previously, as you noted, but this migration did not include the addition of the reset_sent_at
column.
At this point the easiest thing to do would be to create a new migration to add the missing column.
rails generate migration add_reset_sent_at_to_users reset_sent_at:datetime