2014-01-29 66 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