How to fix rails undefined local variable or method ‘confirmed_at’ ?
If you getting like,
and you thinking how can I fix ?
Firstly, you need to create migration
1
rails g migration add_confirmable
then,
1
rake db:migrate
When you write above command, you get again error, like
12345678
== 20140725114621 Addconfirmable: migrating===================================-- change_table(:admins)rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `confirmable' for #<ActiveRecord::ConnectionAdapters::Table:0x007f8739d3e2e0>..../db/migrate/20140725114621_addconfirmable.rb:4:in `block in up'/Users/...../db/migrate/20140725114621_addconfirmable.rb:3:in `up'Tasks: TOP=> db:migrate
(See full trace by running task with --trace)
Let’s fix this bug,
You should open your migration which created and delete
1
t.confirmable
then go to another migration named which
1
..../devise_create....rb
in this file, you should see in comment
12345
## Confirmable## t.string :confirmation_token## t.datetime :confirmed_at## t.datetime :confirmation_sent_at## t.string :unconfirmed_email # Only if using reconfirmable
you should copy or cut above command without comment to your addconfirmable.rb migration file, instead of t.confirmable