Sha256: 936a182cb871b6f73f3d85a7599501626672d12c6b17e1ce2826d44b7421a6b4
Contents?: true
Size: 1020 Bytes
Versions: 13
Compression:
Stored size: 1020 Bytes
Contents
# This module adds a `has_many :collections` association to any models that you mix it into, using the :has_collection_member property # It also provides methods to help you index the information as a facet module Hydra::Collections::Collectible extend ActiveSupport::Autoload extend ActiveSupport::Concern included do #after_solrize << :index_collection_pids has_many :collections, property: :has_collection_member, :class_name => "ActiveFedora::Base" end # Add this method to your solrization logic (ie. in to_solr) in order to populate the 'collection' facet # with the pids of any collections that contain the current object. # @example # def to_solr(solr_doc={}, opts={}) # super(solr_doc, opts) # index_collection_pids(solr_doc) # return solr_doc # end def index_collection_pids(solr_doc={}) solr_doc[Solrizer.solr_name(:collection, :facetable)] = self.collection_ids solr_doc[Solrizer.solr_name(:collection)] = self.collection_ids solr_doc end end
Version data entries
13 entries across 13 versions & 1 rubygems