authenticating through multiple database

I am new to Ruby on rails and in need of some urgent help. I need to
create authentication module for one my projects where I have multiple
databases. One database is connected through LDAP and the other one
is just an internal database which can be accessed directly through
active record. Now, my question is, is there a way to authenticate
against both the databases when some one tries to login? Does rails
provide any such support for this?I have looked at couple of
authentication gems(e.g : Authlogic, Ruby-Cas, RestfulAuthentication),
but all of them seem to provide support for authentication against a
single database.

Any suggestions will be appreciated.