2014-01-29 67 views
0

我正在使用Rails 3.2和MySQL。 我安装了宝石:RGeo:运行空间迁移时出错

gem 'rgeo', '0.3.20' 
gem 'rgeo-activerecord', '0.4.6' 
gem 'activerecord-mysql2spatial-adapter', '0.4.3' 

所有其他要求和依赖关系得到满足,至少我是这么认为的。 然而,以下所建议的程序,用于创建与空间数据在它的模型(here),一步一步,当我运行此迁移:

class CreateLocations < ActiveRecord::Migration 
    def change 
    create_table :locations do |t| 
     t.string :name 
     t.point :latlon 
     t.timestamps 
    end 
    end 
end 

我得到错误:

未定义的方法'point'for#/ ... /。rvm/gems/ruby​​-1.9.3-p484/gems/rgeo-activerecord-0.4.6/lib/rgeo/active_record/common_adapter_elements.rb:105:'method_missing'

有人知道吗?

回答

2

变化

t.point :latlon 

t.column :latlon, :point, :null => false 
+2

你这个修复它,但它为什么必要。我认为这个插件支持t.point。 – deepwinter