aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/table_metadata.rb
Commit message (Collapse)AuthorAgeFilesLines
* Extract an explicit type caster classSean Griffin2014-12-291-32/+1
|
* Rely on the injectable type caster for `arel_table`Sean Griffin2014-12-291-49/+13
| | | | | | | This API will require much less consuming code to change to accomodate the removal of automatic type casting from Arel. As long as the predicates are constructed using the `arel_table` off of an AR subclass, there will be no changes that need to happen.
* Fall back to type casting from the connection adapterSean Griffin2014-12-261-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several valid cases where right now we can't determine the association's class in a call to `where`. In these cases, we can fall back to casting by looking up the column from the connection adapter (which is what happens right now when we fall through to Arel) This is ugly, and since we're trying to separate the concept of a type from a column, I'd like to remove it in the future. The problem basically comes down to this: Liquid.joins(molecules: :electrons) .where("molecules.name" => "something", "electrons.name" => "something") The hash in this case will turn into: { molecules: { name: "something" }, electrons: { name: "something" }, } What we actually need is: { molecules: { name: "something", electrons: { name: "something" }, } } /cc @mrgilman
* Perform casting of single values within the predicate builderSean Griffin2014-12-261-0/+6
| | | | | | | | | | | As part of the larger refactoring to remove type casting from Arel, we need to do the casting of values eagerly. The predicate builder is the closest place that knows about the Active Record class, and can therefore have the type information. /cc @mrgilman [Sean Griffin & Melanie Gilman]
* Remove `klass` and `arel_table` as a dependency of `PredicateBuilder`Sean Griffin2014-12-261-0/+46
This class cares far too much about the internals of other parts of Active Record. This is an attempt to break out a meaningful object which represents the needs of the predicate builder. I'm not fully satisfied with the name, but the general concept is an object which represents a table, the associations to/from that table, and the types associated with it. Many of these exist at the `ActiveRecord::Base` class level, not as properties of the table itself, hence the need for another object. Currently it provides these by holding a reference to the class, but that will likely change in the future. This allows the predicate builder to remain wholy concerned with building predicates. /cc @mrgilman