Revert code from rails2