Sha256: 88e50d00355701b35bed43bf07ae0a92197e801ea9efa8d643777ff76573fa95

Contents?: true

Size: 974 Bytes

Versions: 71

Compression:

Stored size: 974 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def self.up
<% attachment_names.each do |attachment| -%>
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer
    add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime
<% end -%>
  end

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

Version data entries

71 entries across 71 versions & 23 rubygems

Version Path
paperclip-2.3.5 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.3.4 lib/generators/paperclip/templates/paperclip_migration.rb.erb
bookis-paperclip-2.3.3.1 lib/generators/paperclip/templates/paperclip_migration.rb.erb
bookis-paperclip-2.3.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
olek-paperclip-2.3.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
davidray-paperclip-2.3.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
mbailey-paperclip-2.3.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
mbailey-paperclip-2.3.2.1 lib/generators/paperclip/templates/paperclip_migration.rb.erb
mbailey-paperclip-2.3.2 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.3.3 lib/generators/paperclip/templates/paperclip_migration.rb.erb
paperclip-2.3.2 lib/generators/paperclip/templates/paperclip_migration.rb.erb