Formtastic Location Selector
First, you'll need to install Formtastic.
Next, install Maptastic as a plugin:
script/plugin install firstname.lastname@example.org:MattHall/maptastic.git
You'll need to add the Google Maps V3 script include in your page, above your semantic_form:
Note that you no longer need an API key with the latest Google Maps release.
Maptastic adds a new #multi_input method as well as the map control:
<% semantic_form_for @venue do |f| %> <%= f.multi_input :latitude, :longitude, :as => :map %> <% end %>
Note that the map input expects two parameters - a latitude and longitude. The order is important.
This plugin is under development. It's pretty simple, and patches are very welcome.
A testbed app is available to check that the changes made actually work as expected.
Copyright © 2010 Matthew Hall, released under the MIT license.