Added caching / delete of caches if user object changes.

This commit is contained in:
Martin Edenhofer 2012-04-16 13:57:33 +02:00
parent 9a9d21470e
commit 4d591da87d
3 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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