Fix error.nii? to error.nil? in application_controller