Module: MultipleTableInheritance::Migration

Defined in:
lib/multiple_table_inheritance/migration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/multiple_table_inheritance/migration.rb', line 3

def self.included(base)
  base.alias_method_chain :create_table, :inherits
end

Instance Method Details

#create_table_with_inherits(table_name, options = {}, &block) ⇒ Object



7
8
9
10
# File 'lib/multiple_table_inheritance/migration.rb', line 7

def create_table_with_inherits(table_name, options = {}, &block)
  options[:primary_key] = "#{options[:inherits]}_id" if options[:inherits]
  create_table_without_inherits(table_name, options, &block)
end