From 6dc273d93643387114ee0b1031f924338d89e4c8 Mon Sep 17 00:00:00 2001 From: Carlos Paramio Date: Wed, 25 Feb 2009 17:04:44 +0100 Subject: [PATCH] return nil when can't find results --- README.rdoc | 4 ++++ lib/geoplanet/place.rb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/README.rdoc b/README.rdoc index 00217ee..bcab86d 100644 --- a/README.rdoc +++ b/README.rdoc @@ -56,6 +56,10 @@ but this version supports better usage of matrix and query parameters, uses JSON # Postal Codes at Algeciras a.children(:select => "long", :type => 11) + + # You can use multiple types on the same query. + # e.g. Country and Province for Algeciras + a.belongtos(:type => [12, 9]) == REQUIREMENTS: diff --git a/lib/geoplanet/place.rb b/lib/geoplanet/place.rb index e82b6ac..f35e085 100644 --- a/lib/geoplanet/place.rb +++ b/lib/geoplanet/place.rb @@ -102,6 +102,8 @@ def get_then_parse(url) return results['places']['place'].map{|attrs| Place.new attrs} if results['places'] return Place.new(results['place']) if results['place'] nil + rescue + nil end end end