Skip to content
Snippets Groups Projects
Commit 47d42273 authored by Alex Reisner's avatar Alex Reisner
Browse files

Add 'geocoded' and 'not_geocoded' named scopes.

parent 87452465
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,22 @@
#
module Geocoder
##
# Implementation of 'included' hook method.
#
def self.included(base)
base.class_eval do
# named scope: geocoded objects
named_scope :geocoded,
:conditions => "latitude IS NOT NULL AND longitude IS NOT NULL"
# named scope: not-geocoded objects
named_scope :not_geocoded,
:conditions => "latitude IS NULL OR longitude IS NULL"
end
end
##
# Query Google for the coordinates of the given phrase.
# Returns array [lat,lon] if found, nil if not found or if network error.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment