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

Methods included from Permissions::Readable

#private?, #public?, #registered?

Methods included from Permissions::Writable

#paranoid_permissions

Methods included from HumanReadableType

#human_readable_type, #to_solr

Methods included from Noid

#assign_id

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_idsObject

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_objectsEnumerable<ActiveFedora::Base>

Returns an enumerable over the children of this collection.

Returns:



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_templateHyrax::PermissionTemplate

Retrieve the permission template for this collection.

Returns:

Raises:

  • (ActiveRecord::RecordNotFound)


86
87
88
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 86

def permission_template
  Hyrax::PermissionTemplate.find_by!(source_id: id)
end

#to_sObject



67
68
69
# File 'app/models/concerns/hyrax/collection_behavior.rb', line 67

def to_s
  title.present? ? title.join(' | ') : 'No Title'
end