Module: MigrationComments::ActiveRecord::ConnectionAdapters::TableDefinition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



3
4
5
# File 'lib/migration_comments/active_record/connection_adapters/table_definition.rb', line 3

def comment
  @comment
end

Instance Method Details

#collect_comments(table_name) ⇒ Object



18
19
20
21
22
# File 'lib/migration_comments/active_record/connection_adapters/table_definition.rb', line 18

def collect_comments(table_name)
  comments = [comment] + columns.map(&:comment)
  comments.compact!
  comments.each{|comment| comment.table_name = table_name }
end

#column(name, type, options = {}) ⇒ Object



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

def column(name, type, options = {})
  super(name, type, options)
  if options.has_key?(:comment)
    col = self[name]
    col.comment = CommentDefinition.new(nil, name, options[:comment])
  end
  self
end