title: searching through joined polymorphic association with table_name defined
body: <p>i have two models</p>
  <pre><code>class Profession &lt; ApplicationRecord
      has_many :users
  end
  
  class User &lt; ApplicationRecord
  
    self.table_name = 'accounts'
  
    belongs_to :scope, polymorphic: true
  
  end 
  </code></pre>
  <p>and a query:</p>
  <pre><code>Profession.joins(:users).where(accounts: {scope: some_scope_variable })
  </code></pre>
  <p>when I run that i get</p>
  <pre><code>Mysql2::Error: Unknown column 'accounts.scope' in 'where clause'
  </code></pre>
  <p>what i also tried is</p>
  <pre><code>Profession.joins(:users).where(users: {scope: some_scope_variable })
  </code></pre>
  <p>but it also doesnt work and gives similar error</p>
  <pre><code>Mysql2::Error: Unknown column 'users.scope' in 'where clause'
  </code></pre>