Sha256: 419e96ad4ecf1f918db1d0f515d777a99b18538b99bdcd27cbb7e92565e7a639
Contents?: true
Size: 951 Bytes
Versions: 25
Compression:
Stored size: 951 Bytes
Contents
# frozen_string_literal: true module Decidim module UserGroups # Use this class to find the accepted memberships of the given user group. class AcceptedMemberships < Decidim::Query # Syntactic sugar to initialize the class and return the queried objects. # # user_group - a UserGroup that needs to find its accepted memberships def self.for(user_group) new(user_group).query end # Initializes the class. # # user_group - a UserGroup that needs to find its accepted memberships def initialize(user_group) @user_group = user_group end # Finds the accepted memberships of the user group. # # Returns an ActiveRecord::Relation. def query user_group .non_deleted_memberships .includes(:user) .where(role: %w(creator admin member)) end private attr_reader :user_group end end end
Version data entries
25 entries across 25 versions & 1 rubygems