module AlsoMigrate module Migrator def self.included(base) unless base.included_modules.include?(InstanceMethods) base.send :include, InstanceMethods base.class_eval do alias_method :migrate_without_also_migrate, :migrate alias_method :migrate, :migrate_with_also_migrate end end end module InstanceMethods def migrate_with_also_migrate (::AlsoMigrate.configuration || []).each do |config| AlsoMigrate.create_tables(config) end rescue Exception => e puts "AlsoMigrate error: #{e.message}" puts e.backtrace.join("\n") ensure migrate_without_also_migrate end module AlsoMigrate class <