added transactional activerecord middleware