I have two different Rails apps and I would like t o sync the user
databases. What's the best way to do that? I thought of whenever someone
registers with one app the user information is posted to the other app
and vice versa. What would you use for that? JSON? Sinatra?
The main issues to consider are contention and scalability/performance. Can both apps be updated or just one? If both, what happens if both update the same field on the same record at the same time?
If performance isn't an issue, a simple synchronous js call to a RESTful API should be fine, waiting for a "success" response from the remote server. If you're worried about scaling/performance, I'd consider a messaging architecture where each system passes messages to the other and the other listens to the queue. But of course if you do that, handling contentions becomes harder because you will have transactions that "worked" that conflict and will need to have some kind of eventual consistency resolution strategy.
Just to ask the related question, what do people use for message queue's in the Rails world (assuming they're not on JRuby)?
Are you talking about the whole database or just the users table? The
way I read your post it looks like you just want to validate users and
keep only one table for all users. If that is the case why not set up
a connection in the application that does not own the users table that
is only used by the User model? That should be enough to give you
access to the user information you might need.