Skip to Content

Maptastic Now a Gem

Posted on One min read

I’ve just repackaged Maptastic as a gem, giving you a second path to install it.

I also found that someone else is using the Maptastic name in their gem, so to prevent collisions with their name, I’ve renamed my gem to maptastic-form.

Plugin Installation

Same as before - make sure you have Formtastic installed, then in Rails 2.x:

    script/plugin install http://github.com/MattHall/maptastic

and in Rails 3:

    rails plugin install http://github.com/MattHall/maptastic

You’ll need to run the following rake task to install the JS or create your own:

    rake maptastic_form:install

You’ll need to add the Google Maps V3 script include in your page, above your semantic_form:

    <script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=true'></script>

Note that you no longer need an API key with the latest Google Maps release.

Gem Installation Outside of Bundler

Install Formtastic:

    gem install formtastic

Install Maptastic-Form:

    gem install maptastic-form

Add Formtastic and Maptastic to your environment.rb - note that the order in important here:

    config.gem "formtastic"
    config.gem "maptastic-form"

You’ll either need to copy the JS for Maptastic into your javascripts directory manually or write your own and add the Google Maps V3 script include in your page, above your semantic_form:

    <script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=true'></script>