dazuma/rgeo-activerecord — pull request #12 by GUI (2014-03-11 03:22:37+00:00)
Title: Fix compatibility with Rails 4/Arel 4.0.1

I ran into some issues with the activerecord-postgis-adapter under Rails 4. The problem seems to have cropped up since the Arel 4.0.1 release, since the method signature of the Arel stuff changed in that release:
https://github.com/rails/arel/commit/68a95542e1a7a79d9777223fbffd2b982fed0268

There weren't any failing tests in this rgeo-activerecord project, but you can see that this issue was caught by the activerecord-postgis-adapter test suite, since the Rails 4 tests started to fail on [newer pull requests](https://travis-ci.org/dazuma/activerecord-postgis-adapter/jobs/18669917) (basically on any tests run since Arel 4.0.1 was released).

The fix is relatively straightforward, the visitor methods just need to take in an extra, optional argument (attribute). I've made the handling of this extra argument optional, so it continues to work in older Arel versions. I also added some basic tests surrounding this Arel functionality using a FakeRecord class taken from how Arel performs its own similar visitor tests.