I need to be able to catch when my postgresql database returns no rows
in a raw sql query.
In this case it would be an error indicating that the long and lat are
outside of the
shape file.
s = Boundary.find_by_sql("SELECT name, country, stateabb FROM
boundaries WHERE distance( the_geom,''POINT(#{@lon} #{@lat})'')
= 0")
testing with s.nil! does not seem to solve the problem
Any ideas?
Here are two queries one without a record and one with
# SELECT name, country, stateabb FROM boundaries WHERE
distance( the_geom,''POINT(-89.0 0.0)'') = 0;
name | country | stateabb
------+---------+----------
(0 rows)
# SELECT name, country, stateabb FROM boundaries WHERE
distance( the_geom,''POINT(-89.0 43.0)'') = 0;
name | country | stateabb
-----------+---------+----------
Wisconsin | USA | US-WI
(1 row)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---