Class: Specify::Model::Collection

Inherits:
Object
  • Object
show all
Includes:
Updateable
Defined in:
lib/specify/models/collection.rb

Overview

Collections are the lowest level of scope in a Specify::Database.

A Collection belongs to the a Specify::Model::Discipline.

A Collection contains all instances of Specify::Model::CollectionObject belonging to that collection.

Instance Method Summary collapse

Methods included from Updateable

#before_update

Instance Method Details

#embedded_collecting_event?Boolean

Returns false if Specify::Model::CollectionObject instances in self can share Specify::Model::CollectingEvent instances. false otherwise.

Returns:

  • (Boolean)


39
40
41
# File 'lib/specify/models/collection.rb', line 39

def embedded_collecting_event?
  self[:IsEmbeddedCollectingEvent]
end

#highest_catalog_numberObject

Returns the highest Specify::Model::CollectionObject#catalog_number for collection_objects belonging to self.



45
46
47
# File 'lib/specify/models/collection.rb', line 45

def highest_catalog_number
  collection_objects_dataset.max(:CatalogNumber)
end

#inspectObject

Creates a string representation of self.



50
51
52
# File 'lib/specify/models/collection.rb', line 50

def inspect
  "#{self} name: #{self.CollectionName}"
end

#nameObject

Returns a String that is the name of self.



55
56
57
# File 'lib/specify/models/collection.rb', line 55

def name
  self[:CollectionName]
end

#view_set(_collection = nil) ⇒ Object

Returns the Specify::Model::ViewSetObject that belongs to self. The _collection argument will be discared and is only there to allow intances to be used as a Specify::Service::ViewLoader#target.



62
63
64
# File 'lib/specify/models/collection.rb', line 62

def view_set(_collection = nil)
  view_set_dir&.view_set_object
end