Sha256: b7a017e44f0adde56c08b0e9a4e8012c615cc022179c3f0644224672d4a69eaa

Contents?: true

Size: 535 Bytes

Versions: 4

Compression:

Stored size: 535 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def self.up<% attributes.each do |attribute| %>
    <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
  <%- end %>
  end

  def self.down<% attributes.reverse.each do |attribute| %>
    <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
  <%- end %>
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ingoweiss_generators-0.0.6 lib/generators/ingoweiss/templates/migration.erb
ingoweiss_generators-0.0.5 lib/generators/ingoweiss/templates/migration.erb
ingoweiss_generators-0.0.4 lib/generators/ingoweiss/templates/migration.erb
ingoweiss_generators-0.0.3 lib/generators/ingoweiss/templates/migration.erb