Module: Lhm

Defined in:
lib/lhm.rb,
lib/lhm/adapter.rb,
lib/lhm/column_with_sql.rb,
lib/lhm/column_with_type.rb

Overview

Defines the same global namespace as LHM’s gem does to mimic its API while providing a different behaviour. We delegate all LHM’s methods to ActiveRecord so that you don’t need to modify your old LHM migrations

Defined Under Namespace

Classes: Adapter, ColumnWithSql, ColumnWithType

Class Method Summary collapse

Class Method Details

.change_table(table_name, _options = {}, &block) {|Adapter.new(@migration, table_name)| ... } ⇒ Object

Yields an adapter instance so that Lhm migration Dsl methods get delegated to ActiveRecord::Migration ones instead

Parameters:

  • table_name (String)
  • _options (Hash) (defaults to: {})
  • block (Block)

Yields:

  • (Adapter.new(@migration, table_name))


14
15
16
# File 'lib/lhm.rb', line 14

def self.change_table(table_name, _options = {}, &block)
  yield Adapter.new(@migration, table_name)
end

.migration=(migration) ⇒ Object

Sets the migration to apply the adapter to

Parameters:

  • migration (ActiveRecord::Migration)


21
22
23
# File 'lib/lhm.rb', line 21

def self.migration=(migration)
  @migration = migration
end