Sha256: 98a4149a173a57abea7100f194d02e8ca9024bc083f77d049d33fa420624bdfa

Contents?: true

Size: 601 Bytes

Versions: 4

Compression:

Stored size: 601 Bytes

Contents

module CurationConcerns
  module HumanReadableType
    extend ActiveSupport::Concern

    included do
      class_attribute :human_readable_short_description, :human_readable_type
      self.human_readable_type = name.demodulize.titleize
    end

    def human_readable_type
      self.class.human_readable_type
    end

    def to_solr(solr_doc = {})
      super(solr_doc).tap do |doc|
        doc[Solrizer.solr_name('human_readable_type', :facetable)] = human_readable_type
        doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curation_concerns-models-0.5.0 app/models/concerns/curation_concerns/human_readable_type.rb
curation_concerns-models-0.4.0 app/models/concerns/curation_concerns/human_readable_type.rb
curation_concerns-models-0.3.0 app/models/concerns/curation_concerns/human_readable_type.rb
curation_concerns-models-0.2.0 app/models/concerns/curation_concerns/human_readable_type.rb