Skip to content

Instantly share code, notes, and snippets.

@andruu
Created December 19, 2017 17:07
Show Gist options
  • Save andruu/6f9a6e3433df630b8b2c74d1cb5c9137 to your computer and use it in GitHub Desktop.
Save andruu/6f9a6e3433df630b8b2c74d1cb5c9137 to your computer and use it in GitHub Desktop.
def normalized_attributes(attributes)
longitude = attributes.delete(:longitude)
latitude = attributes.delete(:latitude)
attributes[:coordinate] = RGeo::Geographic.spherical_factory(srid: 4326).point(
longitude,
latitude
) if longitude && latitude
attributes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment