Sha256: 71a408aa903e140c642de1442a2c8f7e030c851b07d2fb4228129c7b21ba4bbb

Contents?: true

Size: 528 Bytes

Versions: 7

Compression:

Stored size: 528 Bytes

Contents

module Ddr
  class Collection < Resource

    include HasAttachments
    include HasChildren
    include HasStructMetadata

    alias_method :items, :children

    def components_from_solr
      coll_id = id.id
      query = Ddr::Index::Query.new do
        where collection_id: coll_id
        model 'Ddr::Component'
      end
      query.docs
    end

    def targets
      Ddr.query_service.find_inverse_references_by(resource: self, property: 'for_collection_id')
    end

    def publishable?
      true
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-core-1.1.2 app/models/ddr/collection.rb
ddr-core-1.1.1 app/models/ddr/collection.rb
ddr-core-1.1.0 app/models/ddr/collection.rb
ddr-core-1.0.0 app/models/ddr/collection.rb
ddr-core-0.3.0 app/models/ddr/collection.rb
ddr-core-0.2.2 app/models/ddr/collection.rb
ddr-core-0.2.1 app/models/ddr/collection.rb