def generate_annotation(model)
      max_column_length = model.columns.collect { |c| c.name.length }.max
      annotation = []
      annotation << "#-#{'--' * 38}-"
      annotation << "# #{model.name}"
      annotation << "#"
      annotation << sprintf("# %-#{max_column_length}s SQL Type             Null    Primary Default", "Name")
      annotation << sprintf("# %s -------------------- ------- ------- ----------", "-" * max_column_length)
      format = "# %-#{max_column_length}s %-20s %-7s %-7s %-10s"
      model.columns.each do |column|
        annotation << sprintf(
          format,
          column.name,
          column.sql_type,
          column.null,
          column.name == model.primary_key,
          (column.default || "")
          )
      end
      annotation << "#"
      annotation << "#-#{'--' * 38}-"
      annotation.join("\n") + "\n"
    end
def generate_annotation(model)
      max_column_length = model.columns.collect { |c| c.name.length }.max
      annotation = []
      annotation << "#-#{'--' * 38}-"
      annotation << "# #{model.name}"
      annotation << "#"
      annotation << sprintf("# %-#{max_column_length}s SQL Type             Null    Primary Default", "Name")
      annotation << sprintf("# %s -------------------- ------- ------- ----------", "-" * max_column_length)
      format = "# %-#{max_column_length}s %-20s %-7s %-7s %-10s"
      model.columns.each do |column|
        annotation << sprintf(
          format,
          column.name,
          column.sql_type,
          column.null,
          column.name == model.primary_key,
          (column.default || "")
          )
      end
      annotation << "#"
      annotation << "#-#{'--' * 38}-"
      annotation.join("\n") + "\n"
    end
Generate annotation text.
 @param model [Class] An ActiveRecord model class.