Generate a map from ActiveRecord model.
Generate a map from ActiveRecord model. Integrate a dynamic map in a Rails application. It can display geographical map tiles loaded from OpenStreetMap. The included map viewer is Leaflet.
See rails project -- medusa that refers to this package.
Add this line to your application's Gemfile:
gem 'acts_as_mappable'
And then execute:
$ bundle
Generate configuration file and set your api key.
rails generate acts_as_mappable:config
Add this line to your app/assets/javascripts/application.js
//= require acts_as_mappable
Add this line to your model, if you need mappable.
acts_as_mappable
Call to_map method on model that declared acts_as_mappable.
model.to_map
acts_as_mappable options:
lat: This option is latitude column name. Default value is :latitude.
lng: This option is longitude column name. Default value is :longitude.
name: This option is place name column name. Default value is nil. This option is not required.