fix error
This commit is contained in:
parent
14822f2bbf
commit
34a4181334
|
@ -0,0 +1,19 @@
|
||||||
|
module MemberCleanCache
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
def destroy_cache
|
||||||
|
if self.class==Page
|
||||||
|
MemberIndexCache.where(page_id: self.id).destroy_all
|
||||||
|
else
|
||||||
|
MemberIndexCache.all.destroy_all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
after_save do
|
||||||
|
self.destroy_cache
|
||||||
|
end
|
||||||
|
before_destroy do
|
||||||
|
self.destroy_cache
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue