Module: DeviseGauth::Schema

Included in:
Orm::ActiveRecord::Schema
Defined in:
lib/devise_gauth/schema.rb

Overview

add schema helper for migrations

Instance Method Summary collapse

Instance Method Details

#gauth_enabledObject



27
28
29
30
31
32
33
# File 'lib/devise_gauth/schema.rb', line 27

def gauth_enabled
  if Rails.version >= '5.2'
    apply_devise_schema :gauth_enabled, String, { default: 'f' }
  else
    apply_devise_schema :gauth_enabled, Integer, { default: 0 }
  end
end

#gauth_secretObject

Add gauth_secret columns in the resource's database tables

Examples

For a new resource migration:

create_table :the_resources do |t| t.gauth_secret t.gauth_enabled ... end

or if the resource's table already exists, define a migration and put this in:

change_table :the_resources do |t| t.string :gauth_secret t.boolean :gauth_enabled end



23
24
25
# File 'lib/devise_gauth/schema.rb', line 23

def gauth_secret
  apply_devise_schema :gauth_secret, String
end

#gauth_tmpObject



35
36
37
# File 'lib/devise_gauth/schema.rb', line 35

def gauth_tmp
  apply_devise_schema :gauth_tmp, String
end

#gauth_tmp_datetimeObject



39
40
41
# File 'lib/devise_gauth/schema.rb', line 39

def gauth_tmp_datetime
  apply_devise_schema :gauth_tmp_datetime, Datetime
end