adds devise's confirmable/reconfirmable to user

This commit is contained in:
Juanjo Bazán
2015-07-31 13:50:31 +02:00
parent 0bc5ac01b2
commit 627616d9ff
3 changed files with 32 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
class User < ActiveRecord::Base class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable :recoverable, :rememberable, :trackable, :validatable
def name def name

View File

@@ -0,0 +1,13 @@
class AddConfirmableToDeviseForUsers < ActiveRecord::Migration
def change
# Confirmable
add_column :users, :confirmation_token, :string
add_column :users, :confirmed_at, :datetime
add_column :users, :confirmation_sent_at, :datetime
# Reconfirmable
add_column :users, :unconfirmed_email, :string
add_index :users, :confirmation_token, unique: true
end
end

View File

@@ -11,7 +11,10 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150718091702) do ActiveRecord::Schema.define(version: 20150731110702) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "comments", force: :cascade do |t| create_table "comments", force: :cascade do |t|
t.integer "commentable_id" t.integer "commentable_id"
@@ -27,8 +30,8 @@ ActiveRecord::Schema.define(version: 20150718091702) do
t.datetime "updated_at" t.datetime "updated_at"
end end
add_index "comments", ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type" add_index "comments", ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree
add_index "comments", ["user_id"], name: "index_comments_on_user_id" add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
create_table "debates", force: :cascade do |t| create_table "debates", force: :cascade do |t|
t.string "title" t.string "title"
@@ -48,15 +51,15 @@ ActiveRecord::Schema.define(version: 20150718091702) do
t.datetime "created_at" t.datetime "created_at"
end end
add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id" add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
create_table "tags", force: :cascade do |t| create_table "tags", force: :cascade do |t|
t.string "name" t.string "name"
t.integer "taggings_count", default: 0 t.integer "taggings_count", default: 0
end end
add_index "tags", ["name"], name: "index_tags_on_name", unique: true add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false t.string "email", default: "", null: false
@@ -73,10 +76,15 @@ ActiveRecord::Schema.define(version: 20150718091702) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "first_name" t.string "first_name"
t.string "last_name" t.string "last_name"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
end end
add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
create_table "votes", force: :cascade do |t| create_table "votes", force: :cascade do |t|
t.integer "votable_id" t.integer "votable_id"
@@ -90,7 +98,7 @@ ActiveRecord::Schema.define(version: 20150718091702) do
t.datetime "updated_at" t.datetime "updated_at"
end end
add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope" add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope", using: :btree
add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope" add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope", using: :btree
end end