Module: Paperclip::Schema::TableDefinition

Includes:
DeprecationHelper
Defined in:
lib/paperclip/schema.rb

Instance Method Summary collapse

Instance Method Details

#attachment(*attachment_names) ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/paperclip/schema.rb', line 76

def attachment(*attachment_names)
  options = attachment_names.extract_options!
  attachment_names.each do |attachment_name|
    COLUMNS.each_pair do |column_name, column_type|
      column_options = Schema.column_options(options, column_name)
      column("#{attachment_name}_#{column_name}", column_type, **column_options)
    end
  end
end

#has_attached_file(*attachment_names) ⇒ Object



86
87
88
89
# File 'lib/paperclip/schema.rb', line 86

def has_attached_file(*attachment_names)
  deprecation_warn "Method `t.has_attached_file` in the migration has been deprecated and will be replaced by `t.attachment`."
  attachment(*attachment_names)
end