Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (20 sloc) 0.614 kb
class <%= migration_class_name %> < ActiveRecord::Migration
def change
create_table :<%= table_name %> do |t|
<% attributes.each do |attribute| -%>
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 -%>
<% attributes.select {|attr| attr.has_index? }.each do |attribute| -%>
add_index :<%= table_name %>, :<%= attribute.name %>
<% end -%>
end
end
Jump to Line
Something went wrong with that request. Please try again.