Class: Specify::Model::Locality

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

Overview

Localities are places where something has been collected.

A Locality can belong to a Specify::Model::GeographicName, and is required to join a Specify::Model::CollectingEvent to a Specify::Model::GeographicName.

Instance Method Summary collapse

Methods included from Updateable

#before_update

Instance Method Details

#before_createObject

Sequel hook that assigns a GUID and sets the #coordinate_notation to 3.



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

def before_create
  self[:GUID] = SecureRandom.uuid
  self[:SrcLatLongUnit] = 3
  super
end

#coordinate_notationObject

Returns an Integer in the range 0-3 that designates the format in which latidtudes and longitudes are stored:

0

Decimal degrees

1

Degrees, minutes, and decimal seconds

2

Degrees and decimal minutes

3

None



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

def coordinate_notation
  self[:SrcLatLongUnit]
end

#inspectObject

Creates a string representation of self.



34
35
36
37
# File 'lib/specify/models/locality.rb', line 34

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