diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 16:51:01 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 16:54:12 -0700 |
commit | a11a8ff7840cd5c5ebb881aac61be9771b07b3ba (patch) | |
tree | 1c9fe6fbeb46649ebcb079649163f510d71c52ca /activerecord/lib/active_record/schema_dumper.rb | |
parent | 5f521cbff3c8a46cfc8e16b234294a20c285d00d (diff) | |
download | rails-a11a8ff7840cd5c5ebb881aac61be9771b07b3ba.tar.gz rails-a11a8ff7840cd5c5ebb881aac61be9771b07b3ba.tar.bz2 rails-a11a8ff7840cd5c5ebb881aac61be9771b07b3ba.zip |
Fall back to type casting from the connection adapter
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
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
0 files changed, 0 insertions, 0 deletions