Class: Authorization

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/templates/app/models/authorization.rb

Class Method Summary collapse

Class Method Details

.create_from_hash(hash, user = nil) ⇒ Object



10
11
12
13
# File 'lib/templates/app/models/authorization.rb', line 10

def self.create_from_hash(hash, user = nil)
  user ||= User.create_from_hash!(hash)
  Authorization.create(:user => user, :uid => hash['uid'], :provider => hash['provider'])
end

.find_from_hash(hash) ⇒ Object



6
7
8
# File 'lib/templates/app/models/authorization.rb', line 6

def self.find_from_hash(hash)
  find_by_provider_and_uid(hash['provider'], hash['uid'])
end