Monday, January 3, 2011

[Rails] Handling migrations with multiple databases in Rails

I have a Rails reporting application that will generate reports for
other Rails applications.

As such I need to import legacy databases, but might also over time,
change them.

How do I handle migrations with having, and connecting to, x number of
databases?

I've defined the 'other' databases connections in my classes:

class OtherApp < ActiveRecord::Base
self.abstract_class = true
establish_connection :otherApp1_development # defined in database.yml

def initialize
self.establish_connection
end
end

Yet when I use:

class CreateApplicationExampleOne < OtherApp
def self.up
# definitions etc
end
end

and then try to migrate, it fails.

I hope I'm missing something small here.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate