Sha256: ef852df089e55c98c8e8939c325700a9f8570c5ce77c9410461e33d37832ade4
Contents?: true
Size: 791 Bytes
Versions: 48
Compression:
Stored size: 791 Bytes
Contents
# Routine for updating group caches when a group_nesting is created or destroyed # # Caller provides the group_nesting object module OpenStax module Accounts class UpdateGroupCaches # This transaction needs :repeatable_read to prevent missed updates lev_routine transaction: :repeatable_read protected def exec(group_nesting) subtree_group_ids = group_nesting.member_group.subtree_group_ids supertree_group_ids = group_nesting.container_group.supertree_group_ids tree_group_ids = (subtree_group_ids + supertree_group_ids).uniq Group.where(id: subtree_group_ids).update_all(cached_supertree_group_ids: nil) Group.where(id: supertree_group_ids).update_all(cached_subtree_group_ids: nil) end end end end
Version data entries
48 entries across 48 versions & 1 rubygems