Accessing database in another rails app

Hi Rails Guru,

I am using mephisto blogging system and I need it to access “users”
table of another rails app. Any idea how I can have one rails app
access another rails app’s database?? Note that both rails app have
table called “users”.

Mongdar wrote:

Hi Rails Guru,

I am using mephisto blogging system and I need it to access “users”
table of another rails app. Any idea how I can have one rails app
access another rails app’s database?? Note that both rails app have
table called “users”.

There was something on it once
http://drnicwilliams.com/2007/04/12/magic-multi-connections-a-facility-in-rails-to-talk-to-more-than-one-database-at-a-time/

Have you considered ActiveResource? You could use ARes to use the
public API and it’d allow you to have a different model name for the
other User model:

class MephistoUser < ActiveResource::Base
self.collection_name = ‘users’
end

In your homegrown app you get to use instances of MephistoUser, but
each app gets to deal with it’s own ‘User’ object internally.

On Apr 16, 2:20 am, Roger P. [email protected]

that multi connection is awesome!! thanks!

No problem. Just remember me when you’re app goes viral. :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs