Skip to content

Model and Resource Setup

lerebear edited this page Feb 14, 2016 · 2 revisions

Model and Resource Setup

Table setup

A resource table should define the following columns:

Column Type
tokens text
uid string
provider string

A resources columns will be determined by the features that you intend to use for that resource:

Password Authentication

Column Type
email string
encrypted_password string

Password Reset

Column Type
reset_password_token string
reset_password_sent_at datetime

Trackable

Column Type
current_sign_in_at datetime
last_sign_in_at datetime
current_sign_in_ip string
last_sign_in_ip string
sign_in_count integer

Confirmable

Column Type
confirmation_token string
confirmed_at datetime
confirmation_sent_at datetime
unconfirmed_email string

OmniAuth

Column Type
nickname string
name string
image string

Model Setup

In order to setup token authentication on a given ActiveRecord model, include the ActiveRecord::TokenAuth module.

class User < ActiveRecord::Base
  include GrapeTokenAuth::ActiveRecord::TokenAuth
end