Add some more tests. Fix issue with activerecord fetching schema info in the middle of a query.