unidom-region-china 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e46a6679bd74407ba119f1e828fd9a3691bf28e7
4
- data.tar.gz: 7fa84735cbd1107bc7b8c18c1abacad6efe7cd78
3
+ metadata.gz: 288ec73c692e996d7b7f0add61f7d3ab635d09d1
4
+ data.tar.gz: 59d37b73b55f217f349c84bda7968182d1a19ab9
5
5
  SHA512:
6
- metadata.gz: 52112ed8fe01dad17dd0ca80f4a0633f5e83cb2fe65271371ae93ca7360448270e38322471fe141db6ae6b3fa4ea7c180eaf4613dabdb99ddb9b3d1a0a5ab003
7
- data.tar.gz: 3205bb2ab03c3d9470a8628674b81217101289c77c506c5db57bbb2d059601a37d7b81e58ed29af636b6a7ceb2c64d423ff8a46cc90ea9f06ad5f6c7daa8b9e4
6
+ metadata.gz: 5580430d2bf8f5e9f864aa029710a5616ac8c9b53c15e2f93edaa266d692ee769cbd0dd3e59f481bbdd670f4a902297af88a7a7a2bb84f2c10d54e12820aee31
7
+ data.tar.gz: e8c178359878f29b27011b41c267d8282e9a48b31a463217ec11290c88b3642f1b3b4b42d902f880b676bc6c6d592ec1bf97a23778ac2a79e2f260c1626c099e
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Unidom Region China
2
2
 
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
+
3
5
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The China Region domain model engine includes the Region model and its migration.
4
6
  Unidom (统一领域对象模型)是一系列的领域模型引擎。中国行政区划领域模型引擎包括中国大陆的行政区划模型及其数据迁移脚本。
5
7
 
@@ -20,5 +22,6 @@ bundle exec rake unidom:region:china:import file=/china-region-data/NBS-county/2
20
22
 
21
23
  ## Call the Model:
22
24
  ```ruby
23
- Unidom::Region::China::Region.numeric_coded_as('120000').valid_at.alive.first # Tianjing (天津)
25
+ Unidom::Region::China::Region.root_level # All the 31 province-level regions including Beijing, Tianjin, etc.
26
+ Unidom::Region::China::Region.numeric_coded_as('120000').valid_at.alive.first # Tianjin (天津)
24
27
  ```
@@ -27,7 +27,7 @@ class Unidom::Region::China::Region < ActiveRecord::Base
27
27
 
28
28
  validates :numeric_code, numericality: { integer_only: true }
29
29
  validates :alphabetic_code, allow_blank: true, length: { minimum: 2 }
30
- validates :name, presence: true, length: { maximum: self.columns_hash['name'].limit }
30
+ validates :name, presence: true, length: { maximum: self.columns_hash['name'].limit }
31
31
 
32
32
  belongs_to :scheme, polymorphic: true
33
33
  has_many :locations, class_name: 'Unidom::Geo::Location', as: :region
@@ -39,6 +39,8 @@ class Unidom::Region::China::Region < ActiveRecord::Base
39
39
  scope :name_is, ->(name) { where name: name }
40
40
  scope :being_virtual, ->(virtual = true) { where virtual: virtual }
41
41
 
42
+ scope :root_level, -> { numeric_code_ending_with '0000' }
43
+
42
44
  include ::Unidom::Common::Concerns::ModelExtension
43
45
 
44
46
  def numeric_code_prefix
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Region
3
3
  module China
4
- VERSION = '1.0'.freeze
4
+ VERSION = '1.1'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-region-china
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common