dazuma/activerecord-postgis-adapter — pull request #33 by GUI (2012-10-21 20:48:08+00:00)
Title: Add JRuby compatibility

I'm exploring switching our apps to JRuby, but we depend on this gem for postgis work. With a few small tweaks, I was able to get this gem working under JRuby with [activerecord-jdbcpostgresql-adapter](http://rubygems.org/gems/activerecord-jdbcpostgresql-adapter) (which provides a nearly drop-in replacement for the default `PostgreSQLAdapter` class `PostGISAdapter::MainAdapter` inherits from).

[RGeo](https://github.com/dazuma/rgeo#dependencies) notes that JRuby is only partially supported, but with `ffi-geos` also installed, the postgis adapter seems to at least meet our PostGIS needs, so I thought this basic JRuby support might be helpful to others.

The only backwards compatibility issue is that I removed `pg` as a direct gem dependency, so it's up to the user to either install `pg` or `activerecord-jdbcpostgresql-adapter` depending on their platform. But this is similar to how activerecord deals with postgres by default (`pg` isn't installed, but you'll get a message about adding it to your bundle).

I wasn't able to get activerecord-postgis-adapter's own tests to run (even under MRI Ruby and before I made changes), but our app's complete test suite passes while using this fork under both JRuby and MRI Ruby (both 1.9). For activerecord-postgis-adapter's own tests, I might just be missing something, but I only got errors like:

`NameError: uninitialized constant RGeo::ActiveRecord::PostGISAdapter::Tests::TestSpatialQueries::DEFAULT_AR_CLASS`