|
@@ -1,8 +1,12 @@
|
|
|
-class Authorization < ActiveRecord::Base
|
|
|
+class Authorization < ApplicationModel
|
|
|
belongs_to :user
|
|
|
validates_presence_of :user_id, :uid, :provider
|
|
|
validates_uniqueness_of :uid, :scope => :provider
|
|
|
|
|
|
+ after_create :cache_delete
|
|
|
+ after_update :cache_delete
|
|
|
+ after_destroy :cache_delete
|
|
|
+
|
|
|
def self.find_from_hash(hash)
|
|
|
auth = Authorization.where( :provider => hash['provider'], :uid => hash['uid'] )
|
|
|
if auth && auth.first then
|