Sha256: 7fe624ccf97086a040c949445a6e1a3b3a05458ef5a90273c3df33d2819ecdb7
Contents?: true
Size: 941 Bytes
Versions: 9
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Decidim module UserGroups # Use this class to find the admins of the given user group with the # "admin" role. It returns memberships. class AdminMemberships < Decidim::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 admin users def initialize(user_group) @user_group = user_group end # Finds the admin users of the user group. # # Returns an ActiveRecord::Relation. def query user_group .non_deleted_memberships .includes(:user) .where(role: :admin) end private attr_reader :user_group end end end
Version data entries
9 entries across 9 versions & 1 rubygems