If your databases are exactly the same (the data doesn't require custom processing) and there aren't too many records, you could do this (which allows for foreign keys):
Untested... But you get the idea
#All models and their foreign keys
tales = {Patients => [:doctor_id, :hospital_id],
Doctors => [:hospital_id],
Hospitals}
ActiveRecord::Base.establish_connection :development
max_id = tables.map do |model|
model.maximum(:id)
end.max + 1000
tables.each do |model, fks|
ActiveRecord::Base.establish_connection :development
records = model.find(:all)
ActiveRecord::Base.establish_connection :production
records.each do |record|
#update the foreign keys
fks.each do |attr|
record[attr] += max_id if not record[attr].nil?
end
record.id += max_id
model.create record.attributes
end
end
If you have a LOT of records you might have to portion this out somehow... do it in groups of 10k or something.