geography_helper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -2
- data/lib/geography_helper/form_options_helper.rb +2 -2
- data/lib/geography_helper/version.rb +1 -1
- metadata +8 -3
data/README.md
CHANGED
@@ -20,8 +20,9 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
call `GeographyHelper.states` for a hash of states
|
24
|
-
call `GeographyHelper.
|
23
|
+
call `GeographyHelper::States.new.states` for a hash of nested states
|
24
|
+
call `GeographyHelper::States.new.provinces` for a hash of nested provinces
|
25
|
+
call `GeographyHelper::Countries.new.countries` for a hash of countries
|
25
26
|
|
26
27
|
The gem also provides helper two methods to render state/province and country dropdowns from a Rails select dropdown.
|
27
28
|
|
@@ -2,13 +2,13 @@ module ActionView
|
|
2
2
|
module Helpers
|
3
3
|
module FormOptionsHelper
|
4
4
|
|
5
|
-
def state_options_for_select
|
5
|
+
def state_options_for_select(selected=nil)
|
6
6
|
geography = GeographyHelper::States.new
|
7
7
|
state_options = geography.states
|
8
8
|
province_options = geography.provinces
|
9
9
|
state_and_province_options = {'United States' => state_options['United States'].invert}.merge({'Canada' => province_options['Canada'].invert})
|
10
10
|
|
11
|
-
grouped_options_for_select(state_and_province_options)
|
11
|
+
grouped_options_for_select(state_and_province_options, selected)
|
12
12
|
end
|
13
13
|
|
14
14
|
def country_options_for_select
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geography_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -94,12 +94,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: 2363657394345725380
|
97
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
101
|
none: false
|
99
102
|
requirements:
|
100
103
|
- - '>='
|
101
104
|
- !ruby/object:Gem::Version
|
102
105
|
version: '0'
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
hash: 2363657394345725380
|
103
109
|
requirements: []
|
104
110
|
rubyforge_project:
|
105
111
|
rubygems_version: 1.8.25
|
@@ -107,4 +113,3 @@ signing_key:
|
|
107
113
|
specification_version: 3
|
108
114
|
summary: Hash state, province and country codes.
|
109
115
|
test_files: []
|
110
|
-
has_rdoc:
|