app/models/unidom/geo/china/region.rb in unidom-geo-china-0.3.1 vs app/models/unidom/geo/china/region.rb in unidom-geo-china-0.3.2
- old
+ new
@@ -24,18 +24,19 @@
MDUCG_CODES = [ '11', '12', '31', '50' ].freeze
self.table_name = 'unidom_china_regions'
include Unidom::Common::Concerns::ModelExtension
+ include Unidom::Geo::Concerns::AsRegion
validates :numeric_code, numericality: { integer_only: true }
validates :alphabetic_code, allow_blank: true, length: { minimum: 2 }
validates :name, presence: true, length: { maximum: self.columns_hash['name'].limit }
belongs_to :scheme, polymorphic: true
- has_many :locations, class_name: 'Unidom::Geo::Location', as: :region
- has_many :locatings, through: :locations, source: :locatings
+ #has_many :locations, class_name: 'Unidom::Geo::Location', as: :region
+ #has_many :locatings, through: :locations, source: :locatings
has_many :towns, class_name: 'Unidom::Geo::China::Town'
scope :scheme_is, ->(scheme) { scheme.present? ? where(scheme: scheme) : scheme_id_is.scheme_type_is }
scope :scheme_id_is, ->(scheme_id = Unidom::Common::NULL_UUID) { where scheme_id: scheme_id }