Sha256: 41b145ff9fc32354fcd41aac3d8b7714639495dfdf374e705b6cd06724346f6e

Contents?: true

Size: 804 Bytes

Versions: 10

Compression:

Stored size: 804 Bytes

Contents

class <%= migration_name %> < ActiveRecord::Migration
  def self.up
<% attachments.each do |attachment| -%>
    add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string
    add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string
    add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer
<% end -%>
  end

  def self.down
<% attachments.each do |attachment| -%>
    remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name
    remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type
    remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size
<% end -%>
  end
end

Version data entries

10 entries across 10 versions & 6 rubygems

Version Path
jcnetdev-paperclip-1.0.20080704 generators/paperclip/templates/paperclip_migration.rb
jcnetdev-paperclip-1.1 generators/paperclip/templates/paperclip_migration.rb
jeremydurham-merb_paperclip-0.9.12 lib/generators/templates/%file_name%.rb
jeremydurham-merb_paperclip-0.9.13 lib/generators/templates/%file_name%.rb
peterpunk-merb_paperclip-0.9.3 lib/generators/templates/file_name.rb
peterpunk-merb_paperclip-0.9.4 lib/generators/templates/file_name.rb
rughetto-merb_paperclip-0.9.13 lib/generators/templates/%file_name%.rb
avatar-0.0.5 test/lib/paperclip/generators/paperclip/templates/paperclip_migration.rb
paperclip-2.1.2 generators/paperclip/templates/paperclip_migration.rb
paperclip-2.1.0 generators/paperclip/templates/paperclip_migration.rb