rails/arel — pull request #334 by sgrif (2014-10-29 22:14:41+00:00)
Title: (Do not merge) Deprecate Arel automatically type casting

As we've discussed for a while, we need to remove anything that is getting type information for the purpose of type casting from the connection adapter. This is a model level concern, and should be handled there. (e.g. serialized columns cannot be used in `where` as part of an array, range, or query against a joined table).

This is an attempt at what a path to this could look like. The implementation needs to handle a couple of things:

- Must continue to be lazy (Not certain we actually need it to be lazy, confirmation would be nice)
- Must be possible to differentiate from `Arel::Nodes::BindParam`
- Must be able to handle cases like `between`, where we don't actually know the type of node we're going to get ahead of time.

Consuming code that requires type casting would become a two-stage compilation process (three stage on MySQL2). First we'd compile the tree, then replace the lazy replacement nodes. This is the same process we use to replace bind parameters on MySQL2.

Additionally, this allows us to remove the dependency from `schema_cache`, `table_exists?`, and `columns_hash` on the connection adapter, significantly simplifying the API we expect from our collaborators.

I went conservative here, and added a deprecation cycle. However, since Arel is following Semver, and is considered internal from the point of view of Rails, is this actually needed if it comes with a major version bump?