Make valid_type? public

Fixes https://github.com/rails/rails/commit/f8c8ad56c8a1cb48c6535fd8e248dcb9049e0aa3#L3R608