Skip to content

Instantly share code, notes, and snippets.

@brandon-beacher
Created February 5, 2009 01:05
Show Gist options
  • Save brandon-beacher/58457 to your computer and use it in GitHub Desktop.
Save brandon-beacher/58457 to your computer and use it in GitHub Desktop.
class Customer < ActiveRecord::Base
def self.connect_each(&block)
all.each do |customer|
ActiveRecord::Base.establish_connection customer.database
yield customer
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment