Sha256: 3c42bd4a8c5b0c19b28d096d57908d2f880f1bc170330eebd93d41efe018d13b
Contents?: true
Size: 380 Bytes
Versions: 1
Compression:
Stored size: 380 Bytes
Contents
# frozen_string_literal: true class City < ActiveRecord::Base belongs_to :province has_many :districts, dependent: :destroy scope :with_province, ->(province) { where(province_id: province) } def short_name @short_name ||= name.gsub(/市|自治州|地区|特别行政区/, '') end def siblings @siblings ||= where(nil).with_province(province_id) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
china_regions-0.4.4 | app/models/city.rb |