dazuma/rgeo — Issue #19: Best way to make rails_admin spatial aware?
Author: erictheise
Created: 2011-12-21 19:01:50+00:00
State: open

rails_admin is a Rails engine, distributed as a gem, that creates a pretty interface to models and provides some stats about the data. Some people use it internally, straight out of the box, as a way to manage their data. Others integrate it into their app, or tweak their app so that it merges into the rails_admin look; we've done that at my company. Combined with cancan, models can be exposed in different ways to different roles and one can get productive with this setup quite quickly.

https://github.com/sferik/rails_admin

It doesn't know jack about the spatial field type and blows up when it encounters one, so enabling RGeo and PostGIS will cause problems when rails_admin tries to do its thing with any model that has spatial fields.

I wrote a pair of simple rake tasks to enable and disable the spatial type. The enable task looks to see if the database adapter is 'PostGIS', and adds a line to a file to register that type. The disable task removes that line if it finds it. I made a pull request--

https://github.com/sferik/rails_admin/pull/881

--and the project lead suggested it be made a separate gem.

Seems overly complex to me, but thought I'd ask here to see what people think. One argument might be that rails_admin will eventually need to be able to work with other spatial databases, e.g., Oracle or MS SQL, and, if that's complex, that complexity should be handled apart from rails_admin.

I'd appreciate any feedback. My immediate goals are 1) to make it easy for my team to geo-enable dev, test, and prod environments and 2) to do this in a way that works for others so that 3) we don't have another forked project to maintain.