campfire_logic 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
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 :locations, :where => {:kind => 'location'}
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.select{ |d| d.location? && d.location }
121
+ self.descendants.valid_location
122
122
  end
123
123
 
124
124
  # Returns locations found within this locale.
125
125
  def locations
126
- (self.location_locales.map{ |l| l.location } | [self.location]).compact
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.
@@ -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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "campfire_logic"
8
- s.version = "2.0.2"
8
+ s.version = "2.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roderick Monje"]
@@ -55,7 +55,7 @@ describe Locale do
55
55
  end
56
56
 
57
57
  context 'when location' do
58
- subject { Locale.locations.first }
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 }
@@ -5,11 +5,6 @@ describe Location do
5
5
  end
6
6
 
7
7
  describe Location do
8
- before(:all) do
9
- Locale.delete_all
10
- Location.delete_all
11
- end
12
-
13
8
  context '' do
14
9
  before(:all) { create_locations }
15
10
 
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 2
10
- version: 2.0.2
9
+ - 3
10
+ version: 2.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roderick Monje