Class: City

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/city.rb

Instance Method Summary collapse

Instance Method Details

#full_nameObject



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

def full_name
  [province_name, name].compact.join(' - ')
end

#short_nameObject



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

def short_name
  @short_name ||= name.gsub(/市|自治州|地区|特别行政区/, '')
end

#siblingsObject



28
29
30
# File 'app/models/city.rb', line 28

def siblings
  @siblings ||= where(nil).for_province(province_id)
end