Update dependencies

That. Testing against the latest version of activerecord exposed a performance regression which it would be good to fix asap!
Can you add a comment saying that this is a workaround to an activerecord bug? Even better if you can reference to the rails bug.