Class: Goldencobra::Location

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/goldencobra/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#skip_geocodeObject

Returns the value of attribute skip_geocode.



29
30
31
# File 'app/models/goldencobra/location.rb', line 29

def skip_geocode
  @skip_geocode
end

Instance Method Details

#complete_locationObject



42
43
44
45
46
47
48
# File 'app/models/goldencobra/location.rb', line 42

def complete_location
  result = ""
  result += "#{self.street}" if self.street.present?
  result += " #{self.street_number}" if self.street_number.present?
  result += ", #{self.zip}" if self.zip.present?
  result += " #{self.city}" if self.city.present?
end

#safe_geocodeObject



34
35
36
37
# File 'app/models/goldencobra/location.rb', line 34

def safe_geocode
  geocode
rescue Geocoder::OverQueryLimitError
end

#skip_geocoding_once_or_alwaysObject



54
55
56
57
# File 'app/models/goldencobra/location.rb', line 54

def skip_geocoding_once_or_always
  (Goldencobra::Setting.for_key("goldencobra.locations.geocoding") == "false" ) ||
  self.skip_geocode || self.manual_geocoding
end

#titleObject



50
51
52
# File 'app/models/goldencobra/location.rb', line 50

def title
  self.complete_location
end