I've got a field "location", which is an array [lng, lat].
I have two input fields in the ActiveAdmin form, defined as follows
f.inputs :name => "Location" do
f.input :latitude
f.input :longitude
end
In order to get latitude and longitude I have defined two getters in my model:
def latitude
location[1]
end
def longitude
location[0]
end
The form is shown as expected.
In order to save those value I have created two setter in the model
def latitude=(lat)
self[:location][1] = lat.to_f
end
def longitude=(lon)
self[:location][0] = lon.to_f
end
After the form submit those methods are called, but values are not persisted.
Do I miss something?