(Maint) Lazily load the activerecord code

Turns out that if you try to load activerecord when it isn't available,
things don't work. One of our test configurations tests without
activerecord and so the loading of this code needs to be delayed until
we know that we really want to run these tests.