Migrating restful_authentication


I was wondering if anyone is familiar with restful_authentication plugin.

I have an app which uses restful_authentication and I am creating a new app which will exist at a seperate url. However, I would like users who have registered on app1 to be able to log into app2 without having to register again.

For new members I am going to use establish_connection to save the user to 2 databases.

But for existing members I have tried importing the existing columns from the user database in app1 (encrypted_password, salt etc.) to the user database in app2 which has the same columns, but the log in does not work.

Can anyone suggest why this may be?



Why not use the user table in the old DB for everything instead of duplicating the information in both tables?

HI Sharagoz,

How would I do this?

At a guess, I could probably use establish_connection (point to app1 DB) in the User.rb and Permission.rb model files of app2

Is there another way?

Thanks for the quick response,


Add a new DB connection in database.yml other_db_development:   adapter: mysql   database: other_db_development (etc)

Then in User.rb make it use that connection like so: class User < ActiveRecord::Base   establish_connection(:other_db_development) end

Every CRUD operation on the User model will now go to that database

Nothing needs to be changed in the code of the other application, as the request goes directly to the database.