rgeo / activerecord-mysql2spatial-adapter

ActiveRecord connection adapter for MySQL Spatial Extensions, based on mysql2 and rgeo
48 stars 64 forks source link

mysql2adapter compatability with mysql2 0.3.x and activerecord <= 3.0.x #3

Closed ghazel closed 13 years ago

ghazel commented 13 years ago

The required mysql2 gem version, >= 0.3.6, leads to an incompatibility with ActiveRecord <= 3.0.x.

activerecord-mysql2spatial-adapter (on https://github.com/dazuma/activerecord-mysql2spatial-adapter ) claims to need:

ActiveRecord 3.0.3 or later. Earlier versions will not work. Appears to be compatible with Rails 3.1rc5. mysql2 gem 0.3.6 or later.

However mysql2 specifically disallows this combination (on https://github.com/brianmario/mysql2 ):

NOTE: as of 0.3.0, and ActiveRecord 3.1 - the ActiveRecord adapter has been pulled out of this gem and into ActiveRecord itself. If you need to use mysql2 with Rails versions < 3.1 make sure and specify gem "mysql2", "~> 0.2.7" in your Gemfile"

Indeed, the result of using mysql2 0.3.8 and ActiveRecord 3.0.10 is:

RuntimeError: Please install the mysql2spatial adapter: `gem install activerecord-mysql2spatial-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter)
    from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `establish_connection'

So it seems like activerecord-mysql2spatial-adapter should use mysql2 version 0.2.7 instead when used with ActiveRecord <= 3.0.x, and mysql2 0.3.8 when used with ActiveRecord >= 3.1.

dazuma commented 13 years ago

Whoops, you're right. Thanks. Will get that fix out momentarily.

dazuma commented 13 years ago

Released gem version 0.4.1 with fix.