Sha256: f1ccfa1382c1a509244dadb68c9436772a8f6fc7493fd1d79ed17793047ad896

Contents?: true

Size: 612 Bytes

Versions: 4

Compression:

Stored size: 612 Bytes

Contents

class <%= migration_name.camelize %> < ActiveRecord::Migration
  def change
    create_table :<%= table_name %> do |t|
<% attributes.each do |attribute| -%>
<% if attribute.password_digest? -%>
      t.string :password_digest<%= attribute.inject_options %>
<% else -%>
      t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% end -%>
<% if options[:timestamps] %>
      t.timestamps
<% end -%>
    end
<% attributes_with_index.each do |attribute| -%>
    add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
<% end -%>
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
napa-0.5.0 lib/napa/cli/templates/model/db/migrate/migration.rb.tt
napa-0.4.3 lib/napa/cli/templates/create_table_migration/%migration_filename%.rb.tt
napa-0.4.1 lib/napa/generators/templates/create_table_migration/%migration_filename%.rb.tt
napa-0.4.0 lib/napa/generators/templates/create_table_migration/%migration_filename%.rb.tt