Skip to content

Instantly share code, notes, and snippets.

@zackperdue
Created February 27, 2017 12:23
Show Gist options
  • Save zackperdue/b64a7afd229b780797e1d876dbb9f63a to your computer and use it in GitHub Desktop.
Save zackperdue/b64a7afd229b780797e1d876dbb9f63a to your computer and use it in GitHub Desktop.
In your model...
before_create :set_location
def set_location
factory = RGeo::Geographic.spherical_factory(srid: 4326)
self.lonlat = factory.point(lon, lat)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment