Add Confirmable?

36 views
Skip to first unread message

Chris Schumann

unread,
Oct 5, 2010, 5:02:18 PM10/5/10
to Devise
My very first migration sets up the user table for devise. Now, of
course, I want to add :confirmable to the user fields, but I do not
want to destroy my database.

Any suggestions on how to proceed?

Thanks,
Chris

Carlos Antonio da Silva

unread,
Oct 5, 2010, 5:04:41 PM10/5/10
to plataforma...@googlegroups.com
Just create a new migration with change_table, and add t.confirmable to it.
--
At.
Carlos A. da Silva

Chris Schumann

unread,
Oct 5, 2010, 5:14:33 PM10/5/10
to plataforma...@googlegroups.com
Thanks, Carlos!

I did that in the self.up, did a diff on schema.rb, and used that to
create self.down as follows:
def self.down
change_table(:users) do |t|
t.remove :confirmation_sent_at
t.remove :confirmed_at
t.remove :confirmation_token
end
end

That does revert the table to its previous schema.

Chris

Carlos Antonio da Silva

unread,
Oct 5, 2010, 5:18:52 PM10/5/10
to plataforma...@googlegroups.com
Cool =)
Reply all
Reply to author
Forward
0 new messages