Thanks for your help! It's not really sharing the same database, but
having some models connected to a second database;

I was thinking of a web service, but there is a a lot of interaction
and using AR is just easier..  I now have:

class Remote < ActiveRecord::Base
  self.abstract_class = true
  config = YAML::load(IO.read("#{RAILS_ROOT}" + '/config/remote.yml'))
  self.establish_connection(config[(Rails.env.production? ?
'production' : 'development')])
end

and it's working great!

A `Website` object in the Rails application has_one `Integration`
opbject in the Sinatra application, and it makes very easy to keep the
relation between the two database..

I will probably fetch the database.yml from SI to RoR; my question is:
should I do it on deployment ? Every time the RoR application is
started? onRescue trying to connect? How often and why a database can
change for my app?

I can change it to:

class Remote < ActiveRecord::Base
  self.abstract_class = true
  config = YAML::load(IO.read("#{RAILS_ROOT}" + '/config/remote.yml'))
  begin
   self.establish_connection(config[(Rails.env.production? ?
'production' : 'development')])
  rescue
   [fetch db.yml and reconnect]
  end
end

On Nov 27, 4:40 pm, David Dollar <[email protected]> wrote:
> Would it be possible to have your applications expose an API to talk to each
> other rather than sharing a physical database?

--

You received this message because you are subscribed to the Google Groups 
"Heroku" 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/heroku?hl=en.


Reply via email to