neighborhood 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neighborhood/in_the_neighborhood.rb +6 -4
- data/lib/neighborhood/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad5b713249be461fcaace159ce33fb8321251f7
|
4
|
+
data.tar.gz: 3ff6ec50dc785352c7ff5b503623843b40ee1194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b5a9ffe1a57dd2b8be8fda8088ff36fc6f1cf81eb240fe01bbe84f4195c5b01d1e0e42894a81b08e4533c7399741219416f589d8c4e6412a425d28fa3ef0b3b
|
7
|
+
data.tar.gz: 7b0f281620cff0dd980dc10ead3ded7f864e48a23b7d44bd892691bc632c17d1aefdd04bd484dd390bbf3a023b58c0403bcaa399a5afd73680aad73f20df6748
|
@@ -2,7 +2,7 @@ require 'geocoder'
|
|
2
2
|
|
3
3
|
class << ActiveRecord::Base
|
4
4
|
|
5
|
-
def in_the_neighborhood
|
5
|
+
def in_the_neighborhood(options = {})
|
6
6
|
geocoded_by :address, :latitude => :lat, :longitude => :lng
|
7
7
|
|
8
8
|
after_validation :geocode_if_address
|
@@ -23,9 +23,11 @@ class << ActiveRecord::Base
|
|
23
23
|
:full_address => geo['formatted_address'],
|
24
24
|
}
|
25
25
|
# set country if necessary
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
unless options[:autoset_country] == false
|
27
|
+
country = geo['address_components']
|
28
|
+
.select { |a| a['types'].include?('country') }.first['long_name']
|
29
|
+
attrs[:country] = country if country.present?
|
30
|
+
end
|
29
31
|
# save attributes
|
30
32
|
update_columns(attrs)
|
31
33
|
end
|
data/lib/neighborhood/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neighborhood
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean C Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|