alvinsj/flatten_record

View on GitHub
lib/generators/flatten_record/migration/templates/migration.erb

Summary

Maintainability
Test Coverage
class CreateTable<%=@table_name.camelize %> < ActiveRecord::Migration
  def self.up
    create_table :<%=@table_name %> do |t|
      <% @table_columns.each do |col| %>
      t.<%=col.type %> :<%=col.name %> 
      <% end %>
      t.timestamps
    end
  end
  def self.down
    drop_table :<%=@table_name %>
  end
end