class Object
Public Class Methods
create_from_omniauth(params, <%= class_name.downcase %>, provider) token_expires_at = params['credentials']['expires_at'] ? Time.at(params['credentials']['expires_at']).to_datetime : nil create( <%= class_name.downcase %>: <%= class_name.downcase %>, authentication_provider: provider, uid: params['uid'], token: params['credentials']['token'], token_expires_at: token_expires_at, params: params, ) end end <% end -%>
click to toggle source
# File lib/generators/domp/templates/model_authentication.rb, line 12 def self.create_from_omniauth(params, <%= class_name.downcase %>, provider) token_expires_at = params['credentials']['expires_at'] ? Time.at(params['credentials']['expires_at']).to_datetime : nil create( <%= class_name.downcase %>: <%= class_name.downcase
Public Instance Methods
change()
click to toggle source
# File lib/generators/domp/templates/model_authentications_migration.rb, line 3 def change create_table "<%= class_name.downcase %>_authentications", :force => true do |t| t.integer "<%= class_name.downcase %>_id" t.integer "authentication_provider_id" t.string "uid" t.string "token" t.datetime "token_expires_at" t.text "params" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end add_index "<%= class_name.downcase %>_authentications", ["authentication_provider_id"], :name => "index_<%= class_name.downcase %>_authentications_on_authentication_provider_id" add_index "<%= class_name.downcase %>_authentications", ["<%= class_name.downcase %>_id"], :name => "index_<%= class_name.downcase %>_authentications_on_<%= class_name.downcase %>_id" end