support activerecord 4.0 or later