5

尝试运行迁移以添加空间索引时,获取

Unknown key: spatial/Users/ME/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.2/lib/active_support/core_ext/hash/keys.rb:70:in `block in assert_valid_keys'

使用

  • 红宝石 2.0.353
  • 导轨 4.0.2
  • RGEO 0.3.20
  • RGEO 活动记录 0.4.6
  • 项目清单
  • activerecord-mysql2spatial-adapter 0.4.3

迁移索引文件看起来像

class CreateAddresses < ActiveRecord::Migration
  def change
    create_table :addresses, :options => 'ENGINE=MyISAM' do |t|
      t.string :street_1
      t.string :street2
      t.string :city
      t.string :state
      t.string :zip
      t.string :country
      t.string :full_address
      t.column :latlon, :point, :null => false

      t.timestamps
    end
    add_index :addresses, :latlon, :spatial => true
  end
end

更新

当我将 database.yml 文件中的适配器从 mysql2 更改为 mysql2spatial 时,更正了此错误和其他错误

4

0 回答 0