Sha256: 84f5b43ee2fefd63fc5f2090045baa13fb828f0a40cee6a2cf959c582cbb57e6

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

class AllAttached < ActiveRecord::Base
  has_attached_file :file_presence, :file_content_type, :file_size, :file_all
  has_attached_file :file_default, default: 'file.txt'
  has_attached_image :image_presence, :image_content_type, :image_size, :image_all, presets: :big
  has_attached_image :image_default, presets: [:big, :small], default: 'image.jpg'
  validates :file_presence, attachment_presence: true
  validates :file_content_type, attachment_content_type: { in: ['txt'] }
  validates :file_size, attachment_size: { less_than: 15.kilobytes, greater_than: 10.bytes }
  validates :file_all, attachment_presence: true, attachment_content_type: { in: ['txt'] }, attachment_size: { less_than: 15.kilobytes, greater_than: 10.bytes }
  validates :file_default, attachment_presence: true, attachment_content_type: { in: ['txt'] }, attachment_size: { less_than: 15.kilobytes, greater_than: 10.bytes }
  validates :image_presence, attachment_presence: true
  validates :image_content_type, attachment_content_type: { in: ['jpg'] }
  validates :image_size, attachment_size: { in: 2.kilobytes..60.kilobytes }
  validates :image_all, attachment_presence: true, attachment_content_type: { in: ['jpg'] }, attachment_size: { in: 2.kilobytes..60.kilobytes }
  validates :image_default, attachment_presence: true, attachment_content_type: { in: ['jpg'] }, attachment_size: { in: 2.kilobytes..60.kilobytes }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attachs-0.3.5 test/dummy/app/models/all_attached.rb