modifying the rails middleware