campfire_logic 2.0.2 → 2.0.3
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/VERSION +1 -1
- data/app/models/locale.rb +3 -3
- data/app/models/location.rb +1 -0
- data/campfire_logic.gemspec +1 -1
- data/spec/models/locale_spec.rb +1 -1
- data/spec/models/location_spec.rb +0 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
data/app/models/locale.rb
CHANGED
@@ -20,7 +20,7 @@ class Locale
|
|
20
20
|
scope :canada, :where => {:name => 'Canada'}
|
21
21
|
scope :cities, :where => {:kind => 'city' }
|
22
22
|
scope :countries, :where => {:kind => 'country'}
|
23
|
-
scope :
|
23
|
+
scope :valid_location, :excludes => {:location_id => nil}
|
24
24
|
scope :states, :where => {:kind => 'state'}
|
25
25
|
scope :us, :where => {:name => 'United States'}
|
26
26
|
|
@@ -118,12 +118,12 @@ class Locale
|
|
118
118
|
|
119
119
|
# Returns location-locales found within this locale.
|
120
120
|
def location_locales
|
121
|
-
self.descendants.
|
121
|
+
self.descendants.valid_location
|
122
122
|
end
|
123
123
|
|
124
124
|
# Returns locations found within this locale.
|
125
125
|
def locations
|
126
|
-
(
|
126
|
+
(location_locales.map{ |l| l.location } | [self.location]).compact
|
127
127
|
end
|
128
128
|
|
129
129
|
# Returns an array of this locale's ancestors and itself. Countries are omitted.
|
data/app/models/location.rb
CHANGED
@@ -34,6 +34,7 @@ class Location
|
|
34
34
|
has_and_belongs_to_many :services, :inverse_of => :locations
|
35
35
|
has_one :locale, :dependent => :destroy
|
36
36
|
index [[ :coordinates, Mongo::GEO2D ]], :min => -200, :max => 200
|
37
|
+
scope :geocoded, :excludes => {:coordinates => nil}
|
37
38
|
|
38
39
|
# Macros =========================================================================================
|
39
40
|
attr_accessor :geocoder_result
|
data/campfire_logic.gemspec
CHANGED
data/spec/models/locale_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe Locale do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'when location' do
|
58
|
-
subject { Locale.
|
58
|
+
subject { Locale.valid_location.first }
|
59
59
|
specify { subject.name.should == 'Prospect Park Zoo' }
|
60
60
|
specify { subject.should be_location }
|
61
61
|
specify { subject.geocoding_address.should be_nil }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campfire_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 3
|
10
|
+
version: 2.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roderick Monje
|