pdeffendol / spatial_adapter

Spatial Adapter for ActiveRecord and Rails 2.x and 3.0.x - no longer in active development (try RGeo for Rails 3.1+)
MIT License
198 stars 99 forks source link

Mysql2: uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Column #33

Open canavese opened 12 years ago

canavese commented 12 years ago

Unfortunately, it appears that the newest versions of ActiveRecord (3.2.0.rc1, at least) use: ActiveRecord::ConnectionAdapters::Mysql2Adapter::Column

gems/spatial_adapter-1.2.0/lib/spatial_adapter/mysql2.rb:83:in <module:ConnectionAdapters>': uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Column (NameError) from gems/spatial_adapter-1.2.0/lib/spatial_adapter/mysql2.rb:82:inmodule:ActiveRecord' from gems/spatial_adapter-1.2.0/lib/spatial_adapter/mysql2.rb:81:in <top (required)>' from gems/bundler-1.0.21/lib/bundler/runtime.rb:68:inrequire'

descentintomael commented 12 years ago

This is because of the ActiveRecord commit here: https://github.com/rails/rails/commit/5766539342426e956980bf6f54ef99600cbfc33e#activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb

I've created a fork to fix this here: https://github.com/descentintomael/spatial_adapter

I'm still working on figuring out the :option => "ENGINE=MyISAM" thing though. For whatever reason InnoDB isn't liking the spatial extensions.

descentintomael commented 12 years ago

Solution! I really should have waited on that previous comment:

In your migration for creating the table you want spatial extensions on replace

create_table :my_table_name do |t|

with

create_table(:my_table_name, :options => 'ENGINE=MyISAM') do |t|
RyanNaughton commented 12 years ago

descentintomael, can you submit your pull request to the fagility/spatial_adapter repo? It would be great to have this fix in the main repo as you previously submitted a pull request to a random forked repo instead. Thanks!

descentintomael commented 12 years ago

Done. Thanks for reminding me.

dzimmermann1983 commented 11 years ago

I dont really get it. Is it fixed right now with InnoDB too?