Change type_cast_code to type_cast due to method deprecation in Rails4

See https://github.com/rails/rails/commit/f50c160cd028bd3e16c46dcba7692439daf709c8