Sha256: c665fbd084befef3cab2c8fe7047fb3bb297e83b6ba6c7b51d880f66e7c3bb83

Contents?: true

Size: 642 Bytes

Versions: 83

Compression:

Stored size: 642 Bytes

Contents

class <%= migration_class_name %> < 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 %>
<% elsif attribute.type.to_s != 'asset' -%>
      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

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.7 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.6 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.5 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.4 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.3 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.2 lib/templates/migration/templates/create_table_migration.rb
tenon-1.1.1 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.76 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.75 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.74 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.73 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.72 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.71 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.70 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.69 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.68 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.67 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.66 lib/templates/migration/templates/create_table_migration.rb
tenon-1.0.65 lib/templates/migration/templates/create_table_migration.rb