effective_addresses 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/app/helpers/effective_addresses_helper.rb +5 -5
- data/lib/effective_addresses/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e8cba4d12a78d602faee293d07424ef7ef53ec6
|
4
|
+
data.tar.gz: a92fde9f620c7219cfe3e904da0543b6971e22e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f99a0c80b61790407be9e7ae6d44cf05019bedb366e82cc4fa8e0d3014986d8c5177491a64c4a62b35080bdf6801b8efae126439c9581d5dfa3dea0b6bc5e57
|
7
|
+
data.tar.gz: f0e7f9b9ec536ce1e12ec234d3a9369bae7b674fd4e111806af978c57e527c8e66df3d84dc54f20fd072d514faeac0183e71a3122a60ae4e269e1204382f86b3
|
data/README.md
CHANGED
@@ -216,11 +216,17 @@ Add `config/initializer/geocoder.rb`, below is a sample:
|
|
216
216
|
|
217
217
|
```ruby
|
218
218
|
Geocoder.configure(
|
219
|
-
# geocoding options
|
220
|
-
|
221
|
-
# IP address geocoding service (see below for supported options):
|
219
|
+
# Remote IP address geocoding service (see below for supported options):
|
222
220
|
# https://github.com/alexreisner/geocoder#ip-address-services
|
223
221
|
ip_lookup: :telize,
|
222
|
+
|
223
|
+
# Local IP address file database:
|
224
|
+
# 1. gem 'maxminddb'
|
225
|
+
# 2. download database: http://dev.maxmind.com/geoip/geoip2/geolite2/
|
226
|
+
# 3. save file in db/geocoder
|
227
|
+
# ip_lookup: :geoip2,
|
228
|
+
# geoip2: { file: File.expand_path('../../db/geocoder/GeoLite2-City.mmdb', File.dirname(__FILE__)) },
|
229
|
+
|
224
230
|
cache: Rails.cache,
|
225
231
|
cache_prefix: 'geocoder:'
|
226
232
|
)
|
@@ -28,11 +28,11 @@ module EffectiveAddressesHelper
|
|
28
28
|
address.country = EffectiveAddresses.pre_selected_country
|
29
29
|
address.state = EffectiveAddresses.pre_selected_state if (result[0].present? && EffectiveAddresses.pre_selected_state.present?)
|
30
30
|
elsif @@use_geocoder && request.location.present?
|
31
|
-
|
32
|
-
address.country =
|
33
|
-
address.state =
|
34
|
-
address.postal_code =
|
35
|
-
address.city =
|
31
|
+
location = request.location
|
32
|
+
address.country = location.country_code
|
33
|
+
address.state = location.state_code
|
34
|
+
address.postal_code = location.postal_code
|
35
|
+
address.city = location.city
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|