Support for non-rails environments (only activerecord)

I briefly tweaked source to allow non-rails apps to run the gem without issues. Without these modifications an irrelevant instance of rails environment gets loaded up and brakes the application in my case. Yet same issue can be observed in any app which uses "if defined? Rails".