There is not a ActsAsGmappable
module/class defined in the gem, hence the error.
It seems that it was removed in newer versions of the gem. Try removing that line and see if everything works.
Вопрос
I've setup everything according to README and here's my model
class Building
include Gmaps4rails::ActsAsGmappable
include Mongoid::Document
include Geocoder::Model::Mongoid
acts_as_gmappable :lat => 'location[0]', :lng => 'location[1]',
:address => "address", :normalized_address => "full_address",
:msg => "Sorry, not even Google could figure out where that is"
field :gmaps, :type => Boolean
field :address, :type => String, :default => ""
field :city, :type => String, :default => ""
field :province, :type => String, :default => ""
field :country, :type => String, :default => ""
field :postal_code, :type => Integer
field :location, :type => Array, spacial: {lat: :latitude, lng: :longitude, return_array: true }
## Building index
index({location: "2d"})
def full_address
"#{address}, #{city}, #{province}, #{country}, #{postal_code}"
end
def gmaps4rails_address
full_address
end
end
the controller
@hash = Gmaps4rails.build_markers(@building) do |building, marker|
marker.lat building.location[0]
marker.lng building.location[1]
end
and the view
= gmaps4rails( "markers" => { "data" => @hash.to_json, "options" => { "draggable" => true }})
when I access the control, gives me "uninitialized constant Gmaps4rails::ActsAsGmappable"
Решение
There is not a ActsAsGmappable
module/class defined in the gem, hence the error.
It seems that it was removed in newer versions of the gem. Try removing that line and see if everything works.