unidom-geo-china 0.2 → 0.3

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: c644d279817669978931c34931bc44835a42c084
4
- data.tar.gz: 8f5cea3672acb64e112cfe2c5d8727b206e989ee
3
+ metadata.gz: 70c8f8c8ebb8daffd6de328fba9502812afb8c99
4
+ data.tar.gz: 45165c649ec96997c5de8d6ca2aa951c601492c1
5
5
  SHA512:
6
- metadata.gz: 680ce9d86dec8bec6d500b856704748ebd61cdcba4a802286139c94553fd03847f39e99c3229fda70977d8832dc50a7ea9faec348d3826ff48b2f6f2c651b660
7
- data.tar.gz: d64016110315bbbac2fa61ddefd6f3864e5430e472a4e0a9d78ef114d314a84f9b46bebc4610a963a39ea5f9cb207ef6edce8d2aa247566e88b7b1a4bba66844
6
+ metadata.gz: 7e4db96018499a72be7e123f10e0d6ef75eafcb4ca732ccb9d41dd78d4a631f4c76afe6bddb6aa410bb91e0ec18a201ec206225aa98c312f988bf0e134929e57
7
+ data.tar.gz: 89dd8eba094bed15c66c0b65a3f9f3abf7b067b6545eb6ca398e56a000f88f20d7b5598af89e78bca04981e27001a7d06868866be65d4c9f797dc674027b48ff
data/README.md CHANGED
@@ -6,6 +6,10 @@
6
6
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The China Geo domain model engine includes the Region model and its migration.
7
7
  Unidom (统一领域对象模型)是一系列的领域模型引擎。中国地理领域模型引擎包括中国大陆的行政区划模型及其数据迁移脚本。
8
8
 
9
+ ## Recent Update
10
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
11
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
12
+
9
13
  ## Usage in Gemfile
10
14
  ```ruby
11
15
  gem 'unidom-geo-china'
@@ -15,6 +19,7 @@ gem 'unidom-geo-china'
15
19
  ```shell
16
20
  rake db:migrate
17
21
  ```
22
+ The migration versions start with 2001049156.
18
23
 
19
24
  ## Import Data
20
25
  ```shell
@@ -26,4 +31,7 @@ bundle exec rake unidom:geo:china:town:import file=/china-region-data/NBS-town/2
26
31
  ```ruby
27
32
  Unidom::Geo::China::Region.root_level # All the 31 province-level regions including Beijing, Tianjin, etc.
28
33
  Unidom::Geo::China::Region.numeric_coded_as('120000').valid_at.alive.first # Tianjin (天津)
34
+
35
+ active_locations = region.locations.valid_at.alive
36
+ active_towns = region.towns.valid_at.alive
29
37
  ```
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_self
@@ -10,6 +10,5 @@
10
10
  * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
11
  * file per style scope.
12
12
  *
13
- *= require_tree .
14
13
  *= require_self
15
14
  */
@@ -25,25 +25,28 @@ class Unidom::Geo::China::Region < ActiveRecord::Base
25
25
 
26
26
  self.table_name = 'unidom_china_regions'
27
27
 
28
+ include Unidom::Common::Concerns::ModelExtension
29
+
28
30
  validates :numeric_code, numericality: { integer_only: true }
29
- validates :alphabetic_code, allow_blank: true, length: { minimum: 2 }
30
- validates :name, presence: true, length: { maximum: self.columns_hash['name'].limit }
31
+ validates :alphabetic_code, allow_blank: true, length: { minimum: 2 }
32
+ validates :name, presence: true, length: { maximum: self.columns_hash['name'].limit }
33
+
34
+ belongs_to :scheme, polymorphic: true
31
35
 
32
- belongs_to :scheme, polymorphic: true
33
- has_many :locations, class_name: 'Unidom::Geo::Location', as: :region
34
- has_many :towns, class_name: 'Unidom::Geo::China::Town'
36
+ has_many :locations, class_name: 'Unidom::Geo::Location', as: :region
37
+ has_many :locatings, through: :locations, source: :locatings
38
+
39
+ has_many :towns, class_name: 'Unidom::Geo::China::Town'
35
40
 
36
41
  scope :scheme_is, ->(scheme) { scheme.present? ? where(scheme: scheme) : scheme_id_is.scheme_type_is }
37
- scope :scheme_id_is, ->(scheme_id = ::Unidom::Common::NULL_UUID) { where scheme_id: scheme_id }
38
- scope :scheme_type_is, ->(scheme_type = '' ) { where scheme_type: scheme_type }
42
+ scope :scheme_id_is, ->(scheme_id = Unidom::Common::NULL_UUID) { where scheme_id: scheme_id }
43
+ scope :scheme_type_is, ->(scheme_type = '' ) { where scheme_type: scheme_type }
39
44
 
40
45
  scope :name_is, ->(name) { where name: name }
41
46
  scope :being_virtual, ->(virtual = true) { where virtual: virtual }
42
47
 
43
48
  scope :root_level, -> { numeric_code_ending_with '0000' }
44
49
 
45
- include Unidom::Common::Concerns::ModelExtension
46
-
47
50
  def numeric_code_prefix
48
51
  numeric_code[0..1]
49
52
  end
@@ -2,13 +2,14 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Unidom Geo China</title>
5
- <%= stylesheet_link_tag 'unidom/geo/china/application', media: 'all' %>
6
- <%= javascript_include_tag 'unidom/geo/china/application' %>
5
+ <%= stylesheet_link_tag 'unidom/geo/china/application', media: 'all' %>
7
6
  <%= csrf_meta_tags %>
8
7
  </head>
9
8
  <body>
10
9
 
11
10
  <%= yield %>
12
11
 
12
+ <%= javascript_include_tag 'unidom/geo/china/application' %>
13
+
13
14
  </body>
14
15
  </html>
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Geo
3
3
  module China
4
- VERSION = '0.2'.freeze
4
+ VERSION = '0.3'.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-geo-china
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
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-03-24 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '0.9'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The China Contact domain model engine includes Mobile Phone Number and its relative
29
29
  models. Unidom (统一领域对象模型)是一系列的领域模型引擎。中国地理领域模型引擎包括中国大陆的行政区划及其相关的模型。
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.4.5.1
73
+ rubygems_version: 2.6.4
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Unidom China Geo Domain Model Engine 中国地理领域模型引擎