Fall back to type casting from the connection adapter
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

yhirano55/rails,felipecvo/rails,Spin42/rails,aditya-kapoor/rails,88rabbit/newRails,samphilipd/rails,bradleypriest/rails,kachick/rails,illacceptanything/illacceptanything,kmayer/rails,deraru/rails,Stellenticket/rails,odedniv/rails,esparta/rails,brchristian/rails,travisofthenorth/rails,kaspth/rails,flanger001/rails,travisofthenorth/rails,iainbeeston/rails,baerjam/rails,kmcphillips/rails,amoody2108/TechForJustice,assain/rails,yhirano55/rails,yahonda/rails,gcourtemanche/rails,lucasmazza/rails,deraru/rails,Erol/rails,illacceptanything/illacceptanything,sergey-alekseev/rails,mohitnatoo/rails,palkan/rails,bogdanvlviv/rails,repinel/rails,tjschuck/rails,schuetzm/rails,lcreid/rails,kirs/rails-1,pschambacher/rails,yahonda/rails,felipecvo/rails,MSP-Greg/rails,pvalena/rails,marklocklear/rails,rafaelfranca/omg-rails,voray/rails,palkan/rails,koic/rails,elfassy/rails,Stellenticket/rails,vassilevsky/rails,bradleypriest/rails,mohitnatoo/rails,prathamesh-sonpatki/rails,aditya-kapoor/rails,mtsmfm/rails,gfvcastro/rails,georgeclaghorn/rails,prathamesh-sonpatki/rails,ledestin/rails,kddeisz/rails,Sen-Zhang/rails,koic/rails,kamipo/rails,matrinox/rails,notapatch/rails,hanystudy/rails,printercu/rails,maicher/rails,tijwelch/rails,arunagw/rails,eileencodes/rails,stefanmb/rails,pschambacher/rails,amoody2108/TechForJustice,elfassy/rails,travisofthenorth/rails,kmayer/rails,lucasmazza/rails,tgxworld/rails,amoody2108/TechForJustice,baerjam/rails,yasslab/railsguides.jp,Vasfed/rails,pvalena/rails,deraru/rails,esparta/rails,yawboakye/rails,yawboakye/rails,EmmaB/rails-1,tijwelch/rails,repinel/rails,rbhitchcock/rails,coreyward/rails,coreyward/rails,jeremy/rails,yhirano55/rails,EmmaB/rails-1,rails/rails,Edouard-chin/rails,repinel/rails,marklocklear/rails,lucasmazza/rails,mechanicles/rails,joonyou/rails,gcourtemanche/rails,kddeisz/rails,joonyou/rails,kachick/rails,matrinox/rails,arunagw/rails,jeremy/rails,mtsmfm/railstest,tjschuck/rails,illacceptanything/illacceptanything,xlymian/rails,mtsmfm/railstest,alecspopa/rails,kenta-s/rails,kddeisz/rails,deraru/rails,flanger001/rails,samphilipd/rails,illacceptanything/illacceptanything,betesh/rails,riseshia/railsguides.kr,betesh/rails,aditya-kapoor/rails,mohitnatoo/rails,kmcphillips/rails,sergey-alekseev/rails,elfassy/rails,repinel/rails,printercu/rails,illacceptanything/illacceptanything,Erol/rails,betesh/rails,georgeclaghorn/rails,yasslab/railsguides.jp,fabianoleittes/rails,tgxworld/rails,mijoharas/rails,vipulnsward/rails,notapatch/rails,rossta/rails,ledestin/rails,BlakeWilliams/rails,Envek/rails,mathieujobin/reduced-rails-for-travis,matrinox/rails,odedniv/rails,yalab/rails,rafaelfranca/omg-rails,rossta/rails,illacceptanything/illacceptanything,tgxworld/rails,palkan/rails,utilum/rails,Vasfed/rails,shioyama/rails,bogdanvlviv/rails,flanger001/rails,baerjam/rails,koic/rails,gavingmiller/rails,arjes/rails,kirs/rails-1,starknx/rails,ngpestelos/rails,samphilipd/rails,illacceptanything/illacceptanything,mathieujobin/reduced-rails-for-travis,kachick/rails,arjes/rails,alecspopa/rails,lcreid/rails,illacceptanything/illacceptanything,pschambacher/rails,gauravtiwari/rails,ngpestelos/rails,Edouard-chin/rails,Stellenticket/rails,pvalena/rails,stefanmb/rails,felipecvo/rails,lcreid/rails,richseviora/rails,illacceptanything/illacceptanything,vassilevsky/rails,illacceptanything/illacceptanything,gfvcastro/rails,vipulnsward/rails,vassilevsky/rails,maicher/rails,alecspopa/rails,printercu/rails,mtsmfm/railstest,Stellenticket/rails,eileencodes/rails,Spin42/rails,sergey-alekseev/rails,yhirano55/rails,aditya-kapoor/rails,utilum/rails,shioyama/rails,maicher/rails,georgeclaghorn/rails,mijoharas/rails,joonyou/rails,bogdanvlviv/rails,voray/rails,kmcphillips/rails,betesh/rails,gauravtiwari/rails,BlakeWilliams/rails,assain/rails,rails/rails,sealocal/rails,yawboakye/rails,yahonda/rails,kenta-s/rails,richseviora/rails,kmcphillips/rails,bradleypriest/rails,iainbeeston/rails,esparta/rails,shioyama/rails,ledestin/rails,kamipo/rails,arunagw/rails,schuetzm/rails,Spin42/rails,xlymian/rails,riseshia/railsguides.kr,fabianoleittes/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,travisofthenorth/rails,riseshia/railsguides.kr,illacceptanything/illacceptanything,kenta-s/rails,Edouard-chin/rails,mechanicles/rails,Envek/rails,baerjam/rails,lcreid/rails,yalab/rails,iainbeeston/rails,shioyama/rails,notapatch/rails,gauravtiwari/rails,illacceptanything/illacceptanything,joonyou/rails,vipulnsward/rails,coreyward/rails,tijwelch/rails,gfvcastro/rails,untidy-hair/rails,untidy-hair/rails,hanystudy/rails,Sen-Zhang/rails,gavingmiller/rails,riseshia/railsguides.kr,mechanicles/rails,printercu/rails,88rabbit/newRails,illacceptanything/illacceptanything,mtsmfm/rails,jeremy/rails,gavingmiller/rails,bolek/rails,tjschuck/rails,rbhitchcock/rails,mechanicles/rails,prathamesh-sonpatki/rails,BlakeWilliams/rails,eileencodes/rails,yawboakye/rails,utilum/rails,prathamesh-sonpatki/rails,hanystudy/rails,gcourtemanche/rails,Vasfed/rails,mijoharas/rails,fabianoleittes/rails,marklocklear/rails,Envek/rails,MichaelSp/rails,starknx/rails,georgeclaghorn/rails,utilum/rails,arjes/rails,rails/rails,odedniv/rails,voray/rails,Edouard-chin/rails,mtsmfm/rails,schuetzm/rails,kamipo/rails,MSP-Greg/rails,bogdanvlviv/rails,rossta/rails,pvalena/rails,MSP-Greg/rails,eileencodes/rails,assain/rails,xlymian/rails,flanger001/rails,Vasfed/rails,rbhitchcock/rails,assain/rails,ttanimichi/rails,jeremy/rails,esparta/rails,MichaelSp/rails,rafaelfranca/omg-rails,brchristian/rails,Erol/rails,ngpestelos/rails,rails/rails,brchristian/rails,Sen-Zhang/rails,starknx/rails,yahonda/rails,stefanmb/rails,iainbeeston/rails,EmmaB/rails-1,palkan/rails,richseviora/rails,mathieujobin/reduced-rails-for-travis,kirs/rails-1,schuetzm/rails,sealocal/rails,kaspth/rails,yasslab/railsguides.jp,yasslab/railsguides.jp,88rabbit/newRails,ttanimichi/rails,yalab/rails,kmayer/rails,untidy-hair/rails,bolek/rails,Envek/rails,gfvcastro/rails,tgxworld/rails,ttanimichi/rails,tjschuck/rails,mohitnatoo/rails,Erol/rails,fabianoleittes/rails,vipulnsward/rails,notapatch/rails,kaspth/rails,BlakeWilliams/rails,untidy-hair/rails,MSP-Greg/rails,yalab/rails,sealocal/rails,bolek/rails,kddeisz/rails,MichaelSp/rails,arunagw/rails