Rails 3.1.0,geokit,错误acts_as_mappable

Tac*_*che 1 geokit ruby-on-rails-plugins ruby-on-rails-3.1

我得到了

undefined local variable or method `acts_as_mappable'
Run Code Online (Sandbox Code Playgroud)

使用geokit时出错,经过大量的Goggling和尝试后,我似乎无法纠正问题.

基本上,我安装了以下宝石:

geokit (1.6.0, 1.5.0)
geokit-rails31 (0.1.3)
Run Code Online (Sandbox Code Playgroud)

并在我的模型中有以下内容

class House < ActiveRecord::Base
  acts_as_mappable
end
Run Code Online (Sandbox Code Playgroud)

和Gemfile:

gem 'geokit', '>= 1.5.0'
gem 'geokit-rails31'
Run Code Online (Sandbox Code Playgroud)

我在本地应用程序中执行或不执行以下操作时收到错误.

rails plugin install git://github.com/jlecour/geokit-rails3.git
Run Code Online (Sandbox Code Playgroud)

Tac*_*che 6

好的 - 对于任何需要帮助的人来说,这是解决方案的解决方案......

确保您的项目Gemfile不包含任何类型的geokit信息.

安装geokit

> gem install geokit

> gem list geo
*** LOCAL GEMS ***
geokit (1.6.0, 1.5.0)
Run Code Online (Sandbox Code Playgroud)

卸载geokit-rails3和geokit-rails31

> gem uninstall geokit-rails31 geokit-rails3
Run Code Online (Sandbox Code Playgroud)

在您的项目中,在根级别:

> rails plugin install git://github.com/jlecour/geokit-rails3.git
Run Code Online (Sandbox Code Playgroud)

编辑规范

> vi vendor/plugins/geokit-rails3/geokit-rails3.gemspec
Run Code Online (Sandbox Code Playgroud)

将rails依赖行更改为

s.add_runtime_dependency 'rails', '>= 3.1.0'
Run Code Online (Sandbox Code Playgroud)

现在,编辑Gemfile以包含gem

gem 'geokit-rails3', :path => 'vendor/plugins/geokit-rails3'
Run Code Online (Sandbox Code Playgroud)

注意,Gemfile只包含geokit-rails3的条目,没有普通geokit gem的条目.即没有"宝石'geokit','> = 1.5.0'"条目

然后在你的应用程序根目录中,做一个

bundle install
Run Code Online (Sandbox Code Playgroud)

应该进行设置,现在您可以按照典型的教程进行操作 - 如git说明中所述

https://github.com/jlecour/geokit-rails3
Run Code Online (Sandbox Code Playgroud)