Вопрос

just playing around with the gem 'gmaps4rails' but I'm getting the following routing error

undefined local variable or method `acts_as_gmappable'

I've performed the following steps: 1) added the following to the Gemfile: gem 'gmaps4rails' and bundled 2) generated scaffold Location 3) added the following to my model, location.rb then db:migrate

class Location < ActiveRecord::Base
  attr_accessible :address, :latitude, :longitude
  acts_as_gmappable

  def gmaps4rails_address
    address
  end
end

5) changed my root to the following and deleted the old index file

root :to => 'locations#index'

6) added the following to the body of aplication.html.erb

<%= yield :scripts %>

Seems like it can't find the methods in the gem I installed?

I'm using gmaps4rails v2.0.3, ruby v1.9.3, rails 3.2.1

I've looked on similar topics on stackoverflow and performed simple tasks such as restarting server etc but still the same error.

@apneadiving maybe you could help?

Many thanks

Это было полезно?

Решение

Check out the Docs of gmaps4rails, since 2.* version you don't have to add the acts_as_gmappable method. Now it uses geocoder. Here is an small tutorial, that explains how it works.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top