china_regions 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -43,22 +43,22 @@ bundle install
43
43
 
44
44
  范例:
45
45
 
46
- = form_for @article do |f|
46
+ = form_for @article do |f|
47
47
 
48
- = f.region_select [:province, :city, :district]
48
+ = f.region_select [:province, :city, :district]
49
49
 
50
- # form_tag
51
- = region_select :article, :province_id
52
- = region_select :article, :city_id
53
- = region_select :article, :district_id
50
+ # form_tag
51
+ = region_select :article, :province_id
52
+ = region_select :article, :city_id
53
+ = region_select :article, :district_id
54
54
 
55
- OR
55
+ OR
56
56
 
57
- = region_select :article, :province
58
- = region_select :article, :city
59
- = region_select :article, :district
60
-
61
- = f.submit class: 'btn'
57
+ = region_select :article, :province
58
+ = region_select :article, :city
59
+ = region_select :article, :district
60
+
61
+ = f.submit class: 'btn'
62
62
 
63
63
 
64
64
  ## Contributing
@@ -5,10 +5,13 @@ class District < ActiveRecord::Base
5
5
  attr_accessible :name, :city_id, :name_en, :name_abbr
6
6
 
7
7
  belongs_to :city
8
- belongs_to :province
9
8
 
10
9
  scope :with_city, ->(city) { where(city_id: city) }
11
10
 
11
+ def province
12
+ city.province
13
+ end
14
+
12
15
  def short_name
13
16
  @short_name ||= name.gsub(/区|县|市|自治县/, '')
14
17
  end
@@ -1,5 +1,5 @@
1
1
  en:
2
- views:
2
+ helpers:
3
3
  select: Choose A %{model}
4
4
  activerecord:
5
5
  models:
@@ -26,7 +26,7 @@ module ChinaRegions
26
26
  end
27
27
  end
28
28
  else
29
-
29
+
30
30
  _methods = unless methods.to_s.include?('_id')
31
31
  (methods.to_s + ('_id')).to_sym
32
32
  else
@@ -1,3 +1,3 @@
1
1
  module ChinaRegions
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: china_regions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: