Sha256: bc4ac9145b9cbf6f359b0d90a3e2e76b2e216fcf3688b81bd7ea33d170b136c6

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module CurationConcern
  module Model
    extend ActiveSupport::Concern

    module ClassMethods
      def human_readable_type
        name.demodulize.titleize
      end
    end

    included do
      include Hydra::ModelMixins::CommonMetadata
      include Sufia::ModelMethods
      include Sufia::Noid
      include Sufia::GenericFile::Permissions
      extend ClassMethods

      has_metadata name: "properties", type: PropertiesDatastream, control_group: 'M'
      delegate_to :properties, [:relative_path, :depositor], unique: true
      delegate_to :descMetadata, [:archived_object_type], unique: true
      before_save :set_archived_object_type
    end

    def human_readable_type
      self.class.human_readable_type
    end

    def set_archived_object_type
      self.archived_object_type = human_readable_type
    end

    def to_solr(solr_doc={}, opts={})
      super(solr_doc, opts)
      solr_doc["noid_s"] = noid
      return solr_doc
    end

    def to_param
      noid
    end

    def to_s
      title
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curate-0.1.3 app/repository_models/curation_concern/model.rb