app/services/hyrax/collections/collection_member_service.rb
def add_members(collection_id:, new_members:, user:)
          messages = []
          new_members.map do |new_member|
            begin
              add_member(collection_id: collection_id, new_member: new_member, user: user)
            rescue Hyrax::SingleMembershipError => err
              messages += [err.message]
            end
          end
          raise Hyrax::SingleMembershipError, messages if messages.present?
        end
# Add works and/or collections as members of a collection
# @param collection_id [Valkyrie::ID] the id of the parent collection
# @param new_members [Enumerable<Hyrax::Resource>] the new child collections and/or child works
# @return [Enumerable<Hyrax::Resource>] updated member resources
Add works and/or collections as members of a collection
Add works and / or collections as members of a collection
def add_members(collection_id:, new_members:, user:)
          messages = []
          new_members.map do |new_member|
            begin
              add_member(collection_id: collection_id, new_member: new_member, user: user)
            rescue Hyrax::SingleMembershipError => err
              messages += [err.message]
            end
          end
          raise Hyrax::SingleMembershipError, messages if messages.present?
        end
def add_members ( collection_id : , new_members : , user : ) messages = [ ] new_members . map do | new_member | begin add_member ( collection_id : collection_id , new_member : new_member , user : user ) rescue Hyrax :: SingleMembershipError => err messages += [ err . message ] end end raise Hyrax :: SingleMembershipError , messages if messages . present? end
Add works and/or collections as members of a collection
Add works and / or collections as members of a collection
updated member resources
updated member resources
Enumerable<Hyrax::Resource>
collection_id
the id of the parent collection
the id of the parent collection
new_members
the new child collections and/or child works
the new child collections and / or child works
user