Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've successfully installed PostGIS and using the postgres_ext gem to add support Rails postgis ActiveRecord adapter, but when I try to use a Postgres array column type in my migration, it fails:

t.string :pets, :array => true, :limit => 12

And the error:

rake aborted!
An error has occurred, this and all later migrations canceled:

    undefined method `array' for #<ActiveRecord::ConnectionAdapters::ColumnDefinition:0x007fa8357b3308>
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.9/lib/active_support/core_ext/object/try.rb:36:in `try'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/postgres_ext-0.0.9/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb:197:in `add_column_options!'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/schema_definitions.rb:38:in `add_column_options!'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/schema_definitions.rb:31:in `to_sql'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-postgis-adapter-0.4.3/lib/active_record/connection_adapters/postgis_adapter/spatial_table_definition.rb:76:in `block in to_sql'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-postgis-adapter-0.4.3/lib/active_record/connection_adapters/postgis_adapter/spatial_table_definition.rb:76:in `map'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-postgis-adapter-0.4.3/lib/active_record/connection_adapters/postgis_adapter/spatial_table_definition.rb:76:in `to_sql'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-postgis-adapter-0.4.3/lib/active_record/connection_adapters/postgis_adapter/main_adapter.rb:192:in `create_table'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/migration.rb:466:in `block in method_missing'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `block in say_with_time'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `say_with_time'
    /Users/avishai/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.9/lib/active_record/migration.rb:458:in `method_missing'

Gemfile:

gem "rails", "~> 3.2.9"
gem "airbrake"
gem "pg"
gem "postgres_ext"
gem "activerecord-postgis-adapter"
gem "activerecord-postgres-array", "~> 0.0.8"

Any idea ideas how to fix this?

share|improve this question
add comment

1 Answer

This is a known issue. The problem is that activerecord-postgis-adapter and postgres_ext have competing patches to the PostgreSQL adapter in ActiveRecord and the solution to this is to have either postgres_ext or activerecord-postgis-adapter depend on the other gem. It does not make sense to have postgres_ext depend on activerecord-postgis-adapter, since you do not have to use PostGIS to use the native data types of PostgreSQL

(I am the maintainer of the postgres_ext gem, and I just noticed you are the one that opened the linked issue)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.