Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate


Ralph Shnelvar
So I'm following along in https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users when I get to

Create a New Migration

I'll recreate the migration they recommend here.

class AddConfirmableToDevise < ActiveRecord::Migration
# Note: You can't use change, as User.update_all will fail in the down migration
def up
:users, :confirmation_token, :string
:users, :confirmed_at, :datetime
:users, :confirmation_sent_at, :datetime
# add_column :users, :unconfirmed_email, :string # Only if using reconfirmable
:users, :confirmation_token, unique: true
# User.reset_column_information # Need for some types of updates, but not for update_all.
# To avoid a short time window between running the migration and updating all existing
# users as confirmed, do the following
("UPDATE users SET confirmed_at = NOW()")
# All existing user accounts should be able to log in after this.
# Remind: Rails using SQLite as default. And SQLite has no such function :NOW.
# Use :date('now') instead of :NOW when using SQLite.
# => execute("UPDATE users SET confirmed_at = date('now')")
# Or => User.all.update_all confirmed_at: Time.now

def down
:users, :confirmation_token, :confirmed_at, :confirmation_sent_at
# remove_columns :users, :unconfirmed_email # Only if using reconfirmable

My question: Why is the migration

rails g migration add_confirmable_to_devise

Wouldn't the better name be

rails g migration add_confirmable_to_users

Am I missing something?

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ce594b15-19f3-49da-bd1b-2f49c800160d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.