fix test on activerecord 3.2
support activerecord 4