diff --git a/app/models/authorization.rb b/app/models/authorization.rb index 9e9b1f0c9..739eae3a9 100644 --- a/app/models/authorization.rb +++ b/app/models/authorization.rb @@ -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 diff --git a/app/models/group.rb b/app/models/group.rb index 217c0d7e4..4c46900af 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/models/role.rb b/app/models/role.rb index 33cd819ac..4248f70be 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -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