Fix for ActiveRecord 4.2 and Arel changes

The ActiveRecord fix is pretty straightforward.

In the new Arel version (commit where it breaks is mentioned), the `BindParam` class now subclasses `Node` instead of `SqlLiteral` which means that none of the String methods will work. It's unclear if the needed reordering for Postgres (mentioned in the comment) is now handled by Arel, or if that replacement needs to occur elsewhere.