Sha256: f7351b04547948d736d05526568df4372a405acdcdbb28de2239d6eaaab6767a
Contents?: true
Size: 452 Bytes
Versions: 8
Compression:
Stored size: 452 Bytes
Contents
class Authorization < ActiveRecord::Base belongs_to :user validates_presence_of :user_id, :uid, :provider validates_uniqueness_of :uid, :scope => :provider def self.find_from_hash(hash) find_by_provider_and_uid(hash['provider'], hash['uid']) end 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 end
Version data entries
8 entries across 8 versions & 1 rubygems