Properly handle Rails ujs events.