Sha256: 973ce5816020175ae9d6c2e4394b5201f95472feafea32a7710aea41100b53f3

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
    create_table :<%= table_name %> do |t|
<% for attribute in attributes -%>
      t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>
<% if options[:timestamps] %>
      t.timestamps
<% end -%>
    end
<% if options[:indexes] -%>
<% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
    add_index :<%= table_name %>, :<%= attribute.name %>_id
<% end -%>
<% end -%>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-3.1.0.beta1 lib/rails/generators/active_record/model/templates/migration.rb