Sha256: adccc1aad3eec45cd1164f3f12fbef5d6ec37c965d9e4ae9e21820d9cb472eb6
Contents?: true
Size: 936 Bytes
Versions: 15
Compression:
Stored size: 936 Bytes
Contents
# frozen_string_literal: true module Decidim module UserGroups # Use this class to find the the admins of the given user group with the # "member" role. It returns memberships. class AdminMemberships < Rectify::Query # Syntactic sugar to initialize the class and return the queried objects. # # user_group - a UserGroup that needs to find its admin users def self.for(user_group) new(user_group).query end # Initializes the class. # # user_group - a UserGroup that needs to find its member users def initialize(user_group) @user_group = user_group end # Finds the member users of the user group. # # Returns an ActiveRecord::Relation. def query user_group .memberships .includes(:user) .where(role: :admin) end private attr_reader :user_group end end end
Version data entries
15 entries across 15 versions & 1 rubygems