Class: City
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- City
- Defined in:
- app/models/city.rb
Instance Method Summary collapse
Instance Method Details
#full_name ⇒ Object
20 21 22 |
# File 'app/models/city.rb', line 20 def full_name [province_name, name].compact.join(' - ') end |
#short_name ⇒ Object
24 25 26 |
# File 'app/models/city.rb', line 24 def short_name @short_name ||= name.gsub(/市|自治州|地区|特别行政区/, '') end |
#siblings ⇒ Object
28 29 30 |
# File 'app/models/city.rb', line 28 def siblings @siblings ||= where(nil).for_province(province_id) end |