Search code examples
ruby-on-railsruby-on-rails-3nested-formsgmaps4rails

Gmaps4rails - longitude and latitude in database no updated. <nested form>


I have a model place with attributes name, state, longitude, and latitude. A model travel_plan has many places.

I'm using nested form gem for places in the travel plan form.

My problem is that the longitude and latitude were not updated when name and state were updated.

In my place.rb

belongs_to :travel_plan  

acts_as_gmappable

def gmaps4rails_address
  "#{name},#{state}"
end

def gmaps4rails_infowindow
  "<h4>#{name}</h4>"
end

Solution

  • The answer lies here.

    These two settings are particularly relevant for your question:

    :check_process : true/false (if set to false, geocoding will be made at every save/update)

    :checker : string (only if check_process is true), could be a method or a db column boolean