gem 'rails', '~> 5.2.0'
gem 'mysql2', '~> 0.5.2'
...
gem 'rgeo', '1.0.0'gem 'rgeo-activerecord', '~> 6.0.0'gem 'activerecord-mysql2rgeo-adapter', '2.2.0'
class Create Zones < ActiveRecord::Migration[5.2] def change create_table :zones do |t| t.string :name, null: false t.integer :external_id t.polygon :internal_polygon end endend
# Could not dump table "zones" because of following NameError# uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2RgeoAdapter::INDEX_TYPES
z = Zone.new
z.internal_polygon = RGeo::Cartesian.factory(:srid => 4326).parse_wkt("POLYGON((10 10,20 10,20 20,10 20,10 10))")
z.valid? # true
z.save # TypeError: can't quote RGeo::Cartesian::PolygonImpl from (irb):16