Fixing code and tests for changes with the latest v3.2.13 active record code.

See changes file for details