Module: SchemaPlus::ForeignKeys::Middleware::Migration::CreateTable

Defined in:
lib/schema_plus/foreign_keys/middleware/migration.rb

Instance Method Summary collapse

Instance Method Details

#around(env) {|env| ... } ⇒ Object

Yields:

  • (env)


6
7
8
9
10
11
12
13
14
15
# File 'lib/schema_plus/foreign_keys/middleware/migration.rb', line 6

def around(env)
  if (original_block = env.block)
    config_options = env.options.delete(:foreign_keys) || {}
    env.block = -> (table_definition) {
      table_definition.schema_plus_foreign_keys_config = SchemaPlus::ForeignKeys.config.merge(config_options)
      original_block.call table_definition
    }
  end
  yield env
end