Redefine attribute methods after the column information have been reset

Fixes: https://github.com/rails/rails/issues/17900

@sgrif for review please.