Skip to content

Instantly share code, notes, and snippets.

@kzaitsev
Created December 4, 2014 13:54
Show Gist options
  • Save kzaitsev/0ad1f2b6597af930db63 to your computer and use it in GitHub Desktop.
Save kzaitsev/0ad1f2b6597af930db63 to your computer and use it in GitHub Desktop.
PostGIS search point in districts polygons
scope :contains, -> (point) { where("ST_contains(polygon, ST_Transform(ST_GeomFromText('#{point}', 4326), 4326))") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment