Modifies exception handling to remove activerecord reference when ORM not defined