Sha256: 9e2e84b6efdf66bddb71efd2bc4b7db4c492ccaaa24e807b95a4e5ed7b2cac05

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

== Google Maps for Rails (gmaps4rails)

Gmaps4rails is developped to simply create a Google Map (Gmaps) from:

- model instances (say Users),

- your own json

It's based on Ruby on Rails 3 Engines and uses Google Maps API V3 with Marker Clusterer in option.


== Installation

	gem install gmaps4rails

== Requirements
- <%= yield :head %> (in your header)
- <%= yield :scripts %> (in your footer)
- config.serve_static_assets = true  (in your production.rb)
- jQuery (used for ajax json, not mandatory if you only use the 'json' option)

== Basic configuration
In your model, add:

	acts_as_gmappable

	def gmaps4rails_address
	  self.address #describe how to retrieve the address from your model
	end

Create a migration and add the following fields to your table (here users):

	add_column :users, :latitude, :float #you can change the name, see wiki
	add_column :users, :longitude, :float #you can change the name, see wiki
	add_column :users, :gmaps, :boolean #not mandatory, see wiki

== How to?
=== QuickStart!
Say you have a User model and you want to display all the users on a map.
In your view:

	<%= gmaps4rails_map("User") %>

Done!

=== Same Result, alternative solution
With this version, you won't need jQuery.
In your controller:
 
  @json = User.all.to_gmaps4rails

In your view:

  <%= gmaps4rails_map(@json, { "processing" => 'json' }) %>

Done again!

== Options

* Info window

* Custom Marker

* Scopes

* Create from your own json

* Geocode directly your address and retrieve coordinates. 

* {More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]

== Todo?

Feel free ton contact us, you have your say.

== Copyright
MIT license. Authors: Benjamin Roth, David Ruyer

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gmaps4rails-0.4.0 README.rdoc
gmaps4rails-0.3.0 README.rdoc