Sha256: ba30e80bfee6c8d49886963a4a0c272773bebfa4917e9df51c2c69a65845a2fc

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-rails3-0.1 lib/generators/extension_migration/templates/migration.rb