title: join tables for multiple database tables does not work
body: <p>join tables for multiple database tables does not work in below code</p>
  
  <pre><code>class City &lt; ActiveRecord::Base
    establish_connection :cities_db
    self.table_name_prefix = "cities_db."
    has_many :clients
  end
  
  class Client &lt; ActiveRecord::Base
    # default connection
    belongs_to :city
    self.table_name = "client"
  
    def self.with_cities
      joins(:city)
    end
  end
  
  Client.with_cities # returns ActiveRecord::StatementInvalid: Mysql2::Error: Table 'cities_db.clients' doesn't exist: SELECT `city_db`.`cities`.* FROM `cities_db`.`cities` INNER JOIN `clients` ON `clients`.`city_id` = `cities_db`.`cities`.`id`
  </code></pre>