Sha256: 20e5991b50d69e8c6ea662b542fbb724171f85b9ceec38c61998674c0445a555

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

class <%= migration_name %> < ActiveRecord::Migration
  def self.up
<% attachments.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
<% attachments.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 generators/paperclip_database/templates/paperclip_database_migration.rb.erb