group relationship cache

This commit is contained in:
2458773093
2019-07-15 17:29:54 +03:00
parent fd0d9fc261
commit 3227e74ac6
2 changed files with 10 additions and 2 deletions

View File

@@ -18,4 +18,12 @@ class GroupAccount < ApplicationRecord
belongs_to :account
validates :account_id, uniqueness: { scope: :group_id }
after_commit :remove_relationship_cache
private
def remove_relationship_cache
Rails.cache.delete("relationship:#{account_id}:group#{group_id}")
end
end