Added caching / delete of caches if user object changes.
This commit is contained in:
parent
9a9d21470e
commit
4d591da87d
3 changed files with 13 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
class Group < ActiveRecord::Base
|
||||
class Group < ApplicationModel
|
||||
has_and_belongs_to_many :users
|
||||
after_create :cache_delete
|
||||
after_update :cache_delete
|
||||
after_destroy :cache_delete
|
||||
end
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
class Role < ActiveRecord::Base
|
||||
class Role < ApplicationModel
|
||||
has_and_belongs_to_many :users
|
||||
after_create :cache_delete
|
||||
after_update :cache_delete
|
||||
after_destroy :cache_delete
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue