Module: Paperclip::Schema::TableDefinition

Defined in:
lib/paperclip/schema.rb

Instance Method Summary collapse

Instance Method Details

#attachment(*attachment_names) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/paperclip/schema.rb', line 55

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 = options.merge(options[column_name.to_sym] || {}).except(*COLUMNS.keys)
      column("#{attachment_name}_#{column_name}", column_type, **column_options)
    end
  end
end

#has_attached_file(*attachment_names) ⇒ Object



65
66
67
68
# File 'lib/paperclip/schema.rb', line 65

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