Sha256: 7d5386adf5cbb8cc8f53e55c3294993e30cbf1f0ddda14d2fe7508d5a19533f6
Contents?: true
Size: 977 Bytes
Versions: 4
Compression:
Stored size: 977 Bytes
Contents
require "s3_multipart/uploader/callbacks" require "s3_multipart/uploader/validations" require 'active_support/core_ext/string' require "digest/sha1" module S3Multipart module Uploader class << self attr_accessor :controllers end self.controllers = {} def self.serialize(controller) controllers[controller.to_s.to_sym] end def self.deserialize(digest) controllers.key(digest).to_s.constantize end # Generated multipart upload controllers (which reside in the app/uploaders/multipart # directory in the Rails application) extend this module. module Core include S3Multipart::Uploader::Callbacks include S3Multipart::Uploader::Validations def self.extended(klass) Uploader.controllers[klass.to_s.to_sym] = Digest::SHA1.hexdigest(klass.to_s) end def attach(model) S3Multipart::Upload.class_eval do has_one(model) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems