Created
February 16, 2009 20:37
-
-
Save brandon-beacher/65348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.connect_each(&block) | |
ordered.each do |customer| | |
ActiveRecord::Base.establish_connection customer.environment | |
begin | |
next unless ActiveRecord::Base.connection.active? | |
yield customer | |
rescue | |
next | |
end | |
end | |
# TODO: restore the original connection before returning | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment