Module: CurationConcerns::Collection
- Extended by:
- ActiveSupport::Concern
- Includes:
- RequiredMetadata, Hydra::AccessControls::Permissions, Hydra::WithDepositor, Hydra::Works::CollectionBehavior
- Included in:
- CollectionBehavior
- Defined in:
- app/models/concerns/curation_concerns/collection.rb
Instance Method Summary collapse
-
#add_member_objects(new_member_ids) ⇒ Object
Add member objects by adding this collection to the objects’ member_of_collection association.
-
#add_members(new_member_ids) ⇒ Object
Add members using the members association.
- #member_objects ⇒ Object
Instance Method Details
#add_member_objects(new_member_ids) ⇒ Object
Add member objects by adding this collection to the objects’ member_of_collection association.
16 17 18 19 20 21 22 |
# File 'app/models/concerns/curation_concerns/collection.rb', line 16 def add_member_objects(new_member_ids) Array(new_member_ids).each do |member_id| member = ActiveFedora::Base.find(member_id) member.member_of_collections << self member.save! end end |
#add_members(new_member_ids) ⇒ Object
Add members using the members association.
10 11 12 13 |
# File 'app/models/concerns/curation_concerns/collection.rb', line 10 def add_members(new_member_ids) return if new_member_ids.nil? || new_member_ids.empty? members << ActiveFedora::Base.find(new_member_ids) end |
#member_objects ⇒ Object
24 25 26 |
# File 'app/models/concerns/curation_concerns/collection.rb', line 24 def member_objects ActiveFedora::Base.where("member_of_collection_ids_ssim:#{id}") end |