Hey Hassan,
Thanks for the pointer, I have been looking at the API and the
establish_connection seems like the way to go.
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:username => "myuser",
:password => "mypass",
:database => "somedatabase"
)
The databases both exist on the same server but one is mysql and one
is postgresql.
It is not clear to me how to implement this though?
I suppose I could try adding it in the User model as a before_create
method and pass the params to the other database, but I have no idea
what kind of structure that would have.
Any further input would be very much appreciated, but I will keep this
thread updated if I manage to figure it out.
Best,
Dan
On 7 Mar, 17:09, Hassan Schroeder <[email protected]> wrote:
> On Sun, Mar 7, 2010 at 7:35 AM, DanC <[email protected]> wrote:
> > I have two apps which are independent but I now would like to help
> > them talk to each other. Specifically I would like to allow users
> > registering to one site to be able to have an account created at the
> > other automatically.
>
> > Both sites use Restful_authentication plugin so the User table is the
> > same structure, so all I would need to pass is name, email and
> > password in some sort of information push.
>
> You can open a connection to the other DB and save the User there;
> see the ActiveRecord::Base API doc.
>
> That's probably easier and better than messing with replication. But
> you'll also want to consider other actions besides new (e.g. when the
> user updates their account data -- new email, change password, etc.)
>
> FWIW,
> --
> Hassan Schroeder ------------------------ [email protected]
> twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.