« Return to Thread: Alex Payne (from twitter): Rails doesn't scale

Re: Alex Payne (from twitter): Rails doesn't scale

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View in Thread


Carl Lerche wrote:
> 1) "At this point in time there's no facility in Rails to talk to more
> than one database at a time."

You can set up another model to use another DB connection that's
configured in your database.yml file.  Like so:

class EmailModel < ActiveRecord::Base
  self.abstract_class = true
  establish_connection "#{RAILS_ENV}_email"
end

I have actual models that then subclass from EmailModel that actually
interact with tables in that connection's DB.

In this case, the *_email connection just _happens_ to be to another SQL
Server (gasp!) database on the same server, but there isn't any reason
that I can think of that you shouldn't be able to configure another
connection to go wherever you want and deal with it.

You just have to keep track of your models, etc.

Does that sound right to everyone?

Wes

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: Alex Payne (from twitter): Rails doesn't scale