Location field is used to display a point on a map.
field :coordinates, as: :location
You need to add the
mapkick) gem to your
Gemfile and have the
MAPBOX_ACCESS_TOKEN environment variable with a valid Mapbox key.
By default, the location field is attached to one database column that has the coordinates in plain text with a comma
, joining them (
Avo will take that value, split it by the comma and use the first element as the
latitude and the second one as the
Show view you'll get in interactive map and on the edit you'll get one field where you can edit the coordinates.
It's customary to have the coordinates in two distinct database columns, one named
latitude and another
You can instruct Avo to use those two with the
field :coordinates, as: :location, stored_as: [:latitude, :longitude]
By using this notation, Avo will grab the
longitude from those particular columns to compose the map.
This will also render the
Edit view with two separate fields to edit the coordinates.