Class: Hood

Inherits:
Object
  • Object
show all
Includes:
Geopolitocracy, Mongoid::Document
Defined in:
app/models/hood.rb

Overview

Hood/Neighborhood

Instance Method Summary collapse

Instance Method Details

#as_json(_opts = {}) ⇒ Object



28
29
30
31
32
33
34
# File 'app/models/hood.rb', line 28

def as_json(_opts = {})
  {
    id: id.to_s,
    name: name,
    city: city
  }
end

#ensure_slugObject



15
16
17
18
# File 'app/models/hood.rb', line 15

def ensure_slug
  return unless city
  self.slug ||= "#{city.slug}-#{name}"
end

#phoneObject



20
21
22
# File 'app/models/hood.rb', line 20

def phone
  self[:phone] || city.phone
end

#postalObject



24
25
26
# File 'app/models/hood.rb', line 24

def postal
  self[:postal] || city.postal
end