Class: Specify::Model::Locality

Inherits:
Object
  • Object
show all
Defined in:
lib/specify/models/locality.rb

Overview

Sequel::Model for geographic names (countries, states, counties)

Instance Method Summary collapse

Instance Method Details

#before_createObject

create: rank.add_taxon or parent.add_child


18
19
20
21
22
23
24
# File 'lib/specify/models/locality.rb', line 18

def before_create
  self.Version = 0
  self.TimestampCreated = Time.now
  self.GUID = SecureRandom.uuid
  self.SrcLatLongUnit = 3
  super
end

#before_updateObject


26
27
28
29
30
# File 'lib/specify/models/locality.rb', line 26

def before_update
  self.Version += 1
  self.TimestampModified = Time.now
  super
end

#inspectObject


32
33
34
35
# File 'lib/specify/models/locality.rb', line 32

def inspect
  geo = geographic_name ? "(#{geographic_name.FullName})" : ''
  "id: #{self.LocalityID.to_s}, #{self.LocalityName} #{geo}"
end