Sha256: aa510df53bdffba7adeb357de20a79ecdc0b07f1c60b8aaec88ee20b622df5c0
Contents?: true
Size: 402 Bytes
Versions: 6
Compression:
Stored size: 402 Bytes
Contents
class Upload < ActiveRecord::Base has_attachment( :file, path: 'uploads/:id-:style.:extension', styles: ->(upload) { upload.model.attachments[upload.record_attribute.to_sym][:styles] } ) validates_presence_of :record_type, :record_attribute validates_attachment_presence_of :file def model if record_type record_type.classify.constantize end end end
Version data entries
6 entries across 3 versions & 1 rubygems