AR model using a table form another database

Is there a way to configure an ActiveRecord model to use table in
another
database?

I ask this becouse our user table is a centralized one, used by many
other
applications. These applications use various ways/abstratctions to
authenticate against this authentication data-source. The simples way I
can
think to do this with this Rails app would be to set the User model to
use
this table.

Any way to do this? Maybe a little hack in AR through a plugin?

Thanks in advance.

In database.yml file. just like development, production and test
database info add another one called user_db and add information for
that.
Then in your user model do something like:
class User < ActiveRecord::Base
establish_connection :user_db

end

Hope this should work fine.

http://www.sphred.com

On Jul 26, 8:15 pm, “Marcelo de Moraes S.” [email protected]