Module: S3Multipart::Uploader::Core

Includes:
Callbacks, Validations
Defined in:
lib/s3_multipart/uploader.rb

Overview

Generated multipart upload controllers (which reside in the app/uploaders/multipart directory in the Rails application) extend this module.

Instance Attribute Summary collapse

Attributes included from Validations

#file_types, #size_limits

Attributes included from Callbacks

#on_begin_callback, #on_complete_callback

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validations

#accept, #limit

Methods included from Callbacks

#on_begin, #on_complete

Instance Attribute Details

#modelObject

Returns the value of attribute model.



30
31
32
# File 'lib/s3_multipart/uploader.rb', line 30

def model
  @model
end

#mount_pointObject

Returns the value of attribute mount_point.



30
31
32
# File 'lib/s3_multipart/uploader.rb', line 30

def mount_point
  @mount_point
end

Class Method Details

.extended(klass) ⇒ Object



32
33
34
# File 'lib/s3_multipart/uploader.rb', line 32

def self.extended(klass)
  Uploader.controllers[klass.to_s.to_sym] = Digest::SHA1.hexdigest(klass.to_s)
end

Instance Method Details

#attach(model, options = {}) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/s3_multipart/uploader.rb', line 36

def attach(model, options = {})
  self.mount_point = options.delete(:using)
  self.model = model

  S3Multipart::Upload.class_eval do
    has_one(model, options)
  end
end