Fix activerecord version < 4.X