Sha256: fac7ddb6bafb07e5225f1966a2362bd3ad7cae9d2f1f7aba547fad626caecfa9

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

class Create<%= table_name.camelcase %> < ActiveRecord::Migration

  def <%= old_active_record? ? "self.up" : "change" %>
    create_table :<%= table_name %> do |t|
      t.integer :<%= foreign_key_name %>, :null => false
      t.string :locale, :null => false, :limit => 2
      <%- attributes.each do |attribute| -%>
      t.<%= attribute.type %> :<%= attribute.name %>, :null => false
      <%- end -%>
    end

    add_index :<%= table_name %>, [:<%= foreign_key_name %>, :locale], :unique => true
  end
<% if old_active_record? %>
  def self.down
    drop_table :<%= table_name %>
  end
<% end %>
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
has_translations-1.1.2 lib/generators/templates/migration.rb.erb
has_translations-1.1.1 lib/generators/templates/migration.rb.erb
has_translations-1.1.0 lib/generators/templates/migration.rb.erb
has_translations-1.0.0 lib/generators/templates/migration.rb.erb