Class: Source::Human

Inherits:
Source show all
Defined in:
app/models/source/human.rb

Overview

A human source can be either a single individual person or a group of people (e.g. Tom, Dick and Harry decided that this species is the same as that but haven't written it up yet.)

Constant Summary

Constant Summary

Constants inherited from Source

ALTERNATE_VALUES_FOR

Instance Attribute Summary

Attributes inherited from Source

#abstract, #address, #annote, #author, #bibtex_type, #booktitle, #cached, #cached_author_string, #cached_nomenclature_date, #chapter, #copyright, #crossref, #day, #doi, #edition, #editor, #howpublished, #institution, #isbn, #issn, #journal, #key, #language, #language_id, #month, #note, #number, #organization, #pages, #publisher, #school, #serial_id, #series, #stated_year, #title, #translator, #type, #url, #verbatim, #verbatim_contents, #verbatim_keywords, #volume, #year, #year_suffix

Attributes included from Housekeeping::Users

#by

Instance Method Summary (collapse)

Methods inherited from Source

batch_create, batch_preview, #cited_objects, generate_download, #is_bibtex?, #nearest_by_levenshtein, new_from_citation, new_from_doi, #reject_project_sources

Methods included from Housekeeping::Timestamps

#data_breakdown_for_chartkick_recent

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Instance Method Details

- (Object) at_least_one_person_is_provided (protected)



24
25
26
27
28
# File 'app/models/source/human.rb', line 24

def at_least_one_person_is_provided
  if self.people.size == 0 # size not count
    errors.add(:base, 'at least one person must be provided')     
  end
end

- (Object) authority_name



13
14
15
16
# File 'app/models/source/human.rb', line 13

def authority_name
  last_names = people.collect{|p| p.last_name}
  last_names.to_sentence(last_word_connector: ' & ', two_words_connector: ' & ')
end

- (Object) set_cached (protected)



20
21
22
# File 'app/models/source/human.rb', line 20

def set_cached
  self.cached = self.authority_name 
end