pca*_*asa 5 ruby-on-rails-4 rgeo
在尝试运行迁移以添加空间索引时,请获取
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'
Run Code Online (Sandbox Code Playgroud)
运用
迁移索引文件看起来像
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
Run Code Online (Sandbox Code Playgroud)
UPDATE
当我将database.yml文件中的适配器从mysql2更改为mysql2spatial时,更正了此错误和其他错误
| 归档时间: |
|
| 查看次数: |
1097 次 |
| 最近记录: |