Skip to content

Instantly share code, notes, and snippets.

@kenichi
Last active August 29, 2015 14:04
Show Gist options
  • Save kenichi/97116d3a12b64f02943a to your computer and use it in GitHub Desktop.
Save kenichi/97116d3a12b64f02943a to your computer and use it in GitHub Desktop.
sequel <3 postgis
class Symbol
def method_missing meth, *args
if self == :st
Sequel.function(:"st_#{meth}", *args)
else
super
end
end
end
test_point = :st.buffer( :st.geogfromwkb( :st.setsrid( :st.makepoint( -122, 45 ), 4326 ) ), 100 )
location_buffer = :st.buffer( :st.geogfromwkb( :st.setsrid( :st.makepoint( :longitude, :latitude ), 4326 ) ), :accuracy )
Thing.where( :st.intersects test_point, location_buffer ).all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment