Class: Georeference::Gazetteer
- Inherits:
-
Georeference
- Object
- Georeference
- Georeference::Gazetteer
- Defined in:
- app/models/georeference/gazetteer.rb
Instance Attribute Summary collapse
-
#gazetteer_id ⇒ Object
Returns the value of attribute gazetteer_id.
Instance Method Summary collapse
- #dwc_georeference_attributes(h = {}) ⇒ Object
- #gazetteer ⇒ Object private
- #gazetteer_exists ⇒ Object private
- #set_geographic_item_from_gazetteer ⇒ Object private
Instance Attribute Details
#gazetteer_id ⇒ Object
Returns the value of attribute gazetteer_id.
2 3 4 |
# File 'app/models/georeference/gazetteer.rb', line 2 def gazetteer_id @gazetteer_id end |
Instance Method Details
#dwc_georeference_attributes(h = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/georeference/gazetteer.rb', line 9 def dwc_georeference_attributes(h = {}) super(h) h.merge!( georeferenceSources: "TaxonWorks user-added Gazetteer.", georeferenceRemarks: "Created from a shape in TaxonWorks that a user added to the system.", geodeticDatum: nil ) h[:georeferenceProtocol] = "User selection from the system's user-added shapes." if h[:georeferenceProtocol].blank? h end |
#gazetteer ⇒ Object (private)
22 23 24 25 26 |
# File 'app/models/georeference/gazetteer.rb', line 22 def gazetteer return @gazetteer if defined?(@gazetteer) @gazetteer = ::Gazetteer.find_by(id: gazetteer_id) end |
#gazetteer_exists ⇒ Object (private)
28 29 30 |
# File 'app/models/georeference/gazetteer.rb', line 28 def gazetteer_exists errors.add(:gazetteer_id, :invalid) if gazetteer.nil? end |
#set_geographic_item_from_gazetteer ⇒ Object (private)
32 33 34 |
# File 'app/models/georeference/gazetteer.rb', line 32 def set_geographic_item_from_gazetteer self.geographic_item = gazetteer&.geographic_item if gazetteer_id.present? end |