Sha256: a1a0a74043af55904ec2610c13bb168fa63e92f0aa39bc9cf827865f2e07e879

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def self.up
<% attachment_names.each do |attachment| -%>
    create_table :<%= class_name.underscore.tr('/', '_') %>_<%= attachment.pluralize %> do |t|
      t.integer    :<%= class_name.underscore.tr('/', '_') %>_id
      t.string     :style
      t.binary     :file_contents
    end
<% end -%>
  end

  def self.down
<% attachment_names.each do |attachment| -%>
    drop_table :<%= class_name.underscore.tr('/', '_') %>_<%= attachment.pluralize %>
<% end -%>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperclip_database-2.2.0 lib/generators/paperclip_database/migration/templates/migration.rb.erb