Method: UploadColumn::UploadedFile.upload

Defined in:
lib/upload_column/uploaded_file.rb

.upload(file, instance = nil, attribute = nil, options = {}) ⇒ Object

upload a file. In most cases you want to pass the ActiveRecord instance and the attribute name as well as the file. For a more bare-bones approach, check out SanitizedFile.



41
42
43
44
# File 'lib/upload_column/uploaded_file.rb', line 41

def upload(file, instance = nil, attribute = nil, options = {}) #:nodoc:
  uf = self.new(:upload, file, instance, attribute, options)
  return uf.empty? ? nil : uf
end