Module: MigrationComments::ActiveRecord::ConnectionAdapters::AlterTable

Defined in:
lib/migration_comments/active_record/connection_adapters/alter_table.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/migration_comments/active_record/connection_adapters/alter_table.rb', line 3

def self.included(base)
  base.class_eval do
    alias_method_chain :add_column, :migration_comments
  end
end

Instance Method Details

#add_column_with_migration_comments(name, type, options) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/migration_comments/active_record/connection_adapters/alter_table.rb', line 9

def add_column_with_migration_comments(name, type, options)
  add_column_without_migration_comments(name, type, options)
  if options.keys.include?(:comment)
    column = @adds.last
    column.comment = CommentDefinition.new(nil, @td, name, options[:comment])
  end
end