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