Module: Cell::Ext::Migration::MetadataIntercept

Defined in:
lib/cell/ext/migration.rb

Overview

This module intercepts create_table and drop_table, and updates the list of global tables in ::ActiveRecord::InternalMetadata.

Instance Method Summary collapse

Instance Method Details

#create_table(name, *args, &block) ⇒ Object



79
80
81
82
83
# File 'lib/cell/ext/migration.rb', line 79

def create_table(name, *args, &block)
  super.tap do
    Meta.add_global_table(name) if pass_context == :global
  end
end

#drop_table(name, *args, &block) ⇒ Object



85
86
87
88
89
# File 'lib/cell/ext/migration.rb', line 85

def drop_table(name, *args, &block)
  super.tap do
    Meta.remove_global_table(name) if pass_context == :global
  end
end