rgeo/activerecord-postgis-adapter

"Unknown key: :spatial" when creating an index on point column

Closed this issue · 1 comments

c0ze commented

I have a Grape, Otr-ActiveRecord, Postgres application I am trying to setup with postgis.

I changed my adapter and enabled the extension via migration with no problems.
I am trying to add a Geo Point to one of my models via this migration :

    add_column :model, :latlon, :point, geographic: true
    add_index :model, :latlon, spatial: true

This migration fails with

-- add_column(:model, :latlon, :point, {:geographic=>true})
   -> 0.0040s
-- add_index(:model, :latlon, {:spatial=>true})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Unknown key: :spatial. Valid keys are: :unique, :order, :name, :where, :length, :internal, :using, :algorithm, :type

Adding the point column seems to work ok, but adding the index fails. Am I forgetting a step ? Why is spatial index not recognised ? (or is this obsolete now ?)

c0ze commented

it seems I was using an obsolete example. removing spatial key and adding using: :gist solved it.