Module: CurationConcern::Model

Extended by:
ActiveSupport::Concern
Included in:
Article, Dataset, Etd, GenericWork, Image, Person
Defined in:
app/repository_models/curation_concern/model.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ids_from_tokens(tokens) ⇒ Object

Parses a comma-separated string of tokens, returning an array of ids



27
28
29
# File 'app/repository_models/curation_concern/model.rb', line 27

def self.ids_from_tokens(tokens)
  tokens.gsub(/\s+/, "").split(',')
end

Instance Method Details

#as_json(options) ⇒ Object



31
32
33
# File 'app/repository_models/curation_concern/model.rb', line 31

def as_json(options)
  { pid: pid, title: title, model: self.class.to_s, curation_concern_type: human_readable_type }
end

#human_readable_typeObject



22
23
24
# File 'app/repository_models/curation_concern/model.rb', line 22

def human_readable_type
  self.class.human_readable_type
end

#to_partial_pathObject

Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object.



50
51
52
# File 'app/repository_models/curation_concern/model.rb', line 50

def to_partial_path 
  "curation_concern/#{super}"
end

#to_sObject



45
46
47
# File 'app/repository_models/curation_concern/model.rb', line 45

def to_s
  title
end

#to_solr(solr_doc = {}, opts = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'app/repository_models/curation_concern/model.rb', line 35

def to_solr(solr_doc={}, opts={})
  super(solr_doc, opts)
  index_collection_pids(solr_doc)
  solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
  solr_doc[Solrizer.solr_name('human_readable_type',:facetable)] = human_readable_type
  solr_doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
  Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable)
  return solr_doc
end