【问题标题】:RGeo: error when running spatial migrationRGeo:运行空间迁移时出错
【发布时间】:2014-02-15 23:06:56
【问题描述】:

我正在使用 Rails 3.2 和 MySQL。 我安装了宝石:

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

我得到错误:

#/.../.rvm/gems/ruby-1.9.3-p484/gems/rgeo-activerecord-0.4.6/lib/rgeo/active_record/common_adapter_elements.rb:105 的未定义方法“点”:在'method_missing'中

有人知道吗?

【问题讨论】:

    标签: ruby-on-rails rgeo


    【解决方案1】:

    改变

    t.point :latlon
    

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

    【讨论】:

    • 你这解决了它,但为什么它是必要的。我认为插件支持 t.point。
    猜你喜欢
    • 1970-01-01
    • 2017-12-17
    • 2016-08-17
    • 2015-04-06
    • 1970-01-01
    • 2011-03-13
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多