-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gerando model user apartir do devise
- Loading branch information
1 parent
2370df9
commit 9a767bd
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class User < ActiveRecord::Base | ||
# Include default devise modules. Others available are: | ||
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable | ||
devise :database_authenticatable, :registerable, :omniauthable, | ||
:recoverable, :rememberable, :trackable, :validatable | ||
|
||
# Setup accessible (or protected) attributes for your model | ||
attr_accessible :email, :password, :password_confirmation, :remember_me | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class DeviseCreateUsers < ActiveRecord::Migration | ||
def change | ||
create_table(:users) do |t| | ||
## Database authenticatable | ||
t.string :email, :null => false, :default => "" | ||
t.string :encrypted_password, :null => false, :default => "" | ||
|
||
## Recoverable | ||
t.string :reset_password_token | ||
t.datetime :reset_password_sent_at | ||
|
||
## Rememberable | ||
t.datetime :remember_created_at | ||
|
||
## Trackable | ||
t.integer :sign_in_count, :default => 0 | ||
t.datetime :current_sign_in_at | ||
t.datetime :last_sign_in_at | ||
t.string :current_sign_in_ip | ||
t.string :last_sign_in_ip | ||
|
||
## Encryptable | ||
# t.string :password_salt | ||
|
||
## Confirmable | ||
# t.string :confirmation_token | ||
# t.datetime :confirmed_at | ||
# t.datetime :confirmation_sent_at | ||
# t.string :unconfirmed_email # Only if using reconfirmable | ||
|
||
## Lockable | ||
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts | ||
# t.string :unlock_token # Only if unlock strategy is :email or :both | ||
# t.datetime :locked_at | ||
|
||
## Token authenticatable | ||
# t.string :authentication_token | ||
|
||
|
||
t.timestamps | ||
end | ||
|
||
add_index :users, :email, :unique => true | ||
add_index :users, :reset_password_token, :unique => true | ||
# add_index :users, :confirmation_token, :unique => true | ||
# add_index :users, :unlock_token, :unique => true | ||
# add_index :users, :authentication_token, :unique => true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# encoding: UTF-8 | ||
# This file is auto-generated from the current state of the database. Instead | ||
# of editing this file, please use the migrations feature of Active Record to | ||
# incrementally modify your database, and then regenerate this schema definition. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended to check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(:version => 20120523110618) do | ||
|
||
create_table "users", :force => true do |t| | ||
t.string "email", :default => "", :null => false | ||
t.string "encrypted_password", :default => "", :null => false | ||
t.string "reset_password_token" | ||
t.datetime "reset_password_sent_at" | ||
t.datetime "remember_created_at" | ||
t.integer "sign_in_count", :default => 0 | ||
t.datetime "current_sign_in_at" | ||
t.datetime "last_sign_in_at" | ||
t.string "current_sign_in_ip" | ||
t.string "last_sign_in_ip" | ||
t.datetime "created_at", :null => false | ||
t.datetime "updated_at", :null => false | ||
end | ||
|
||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true | ||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true | ||
|
||
end |