Fix deprecation warning for type_cast_code

The method type_cast_code has been deprecated and is now replaced by type_cast. This simply switches them out.

For deprecation see  https://github.com/rails/rails/commit/f50c160cd028bd3e16c46dcba7692439daf709c8