Module: Hyrax::CollectionBehavior
- Extended by:
- ActiveSupport::Concern
- Includes:
- Hydra::AccessControls::WithAccessRight, Hydra::WithDepositor, Hydra::Works::CollectionBehavior, CoreMetadata, HasRepresentative, HumanReadableType, Noid, Permissions
- Included in:
- Collection
- Defined in:
- app/models/concerns/hyrax/collection_behavior.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #collection_type=(new_collection_type) ⇒ Object
-
#member_object_ids ⇒ Object
Use this query to get the ids of the member objects (since the containment association has been flipped).
-
#member_objects ⇒ Enumerable<ActiveFedora::Base>
An enumerable over the children of this collection.
-
#permission_template ⇒ Hyrax::PermissionTemplate
Retrieve the permission template for this collection.
- #to_s ⇒ Object
Methods included from Permissions::Readable
#private?, #public?, #registered?
Methods included from Permissions::Writable
Methods included from HumanReadableType
#human_readable_type, #to_solr
Methods included from Noid
Instance Method Details
#collection_type=(new_collection_type) ⇒ Object
51 52 53 |
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 51 def collection_type=(new_collection_type) self.collection_type_gid = new_collection_type.to_global_id end |
#member_object_ids ⇒ Object
Use this query to get the ids of the member objects (since the containment association has been flipped)
62 63 64 65 |
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 62 def member_object_ids return [] unless id member_objects.map(&:id) end |
#member_objects ⇒ Enumerable<ActiveFedora::Base>
Returns an enumerable over the children of this collection.
56 57 58 |
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 56 def member_objects ActiveFedora::Base.where("member_of_collection_ids_ssim:#{id}") end |
#permission_template ⇒ Hyrax::PermissionTemplate
Retrieve the permission template for this collection.
86 87 88 |
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 86 def Hyrax::PermissionTemplate.find_by!(source_id: id) end |
#to_s ⇒ Object
67 68 69 |
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 67 def to_s title.present? ? title.join(' | ') : 'No Title' end |