I have a specific database (called account_base) for my account :
class Account < ActiveRecord::Base
establish_connection :account_base
...
end
I have user from app rails database :
class User < ActiveRecord::Base
belongs_to :account
end
When I try User.first.account
this work fine.
Now I want get all users with account => state == Account::STATE_ACTIVED, I try :
User.includes(:account).where('accounts.state' => Account::STATE_ACTIVED)
but I have this error :
Mysql2::Error: Table 'RAILS_DATABASE_NAME.accounts' doesn't exist
I try with where('account_base.accounts.state'
to specify the bd, but not works
Any idea ?