Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Deprecate DelayStorage in favor of delay to be in line with what is a…

…ctually happening
  • Loading branch information...
commit d966152fffa5efa08a92f9d41181808fc76ed11b 1 parent a297dc1
Larry Sprock lardawge authored
4 README.md
Source Rendered
@@ -37,14 +37,12 @@ In your CarrierWave uploader file:
37 37
38 38 ```ruby
39 39 class AvatarUploader < CarrierWave::Uploader::Base
40   - include ::CarrierWave::Backgrounder::DelayStorage
  40 + include ::CarrierWave::Backgrounder::Delay
41 41
42 42 #etc...
43 43 end
44 44 ```
45 45
46   -(`DelayStorage` is required for **both** `process_in_background` and `store_in_background`.)
47   -
48 46 ### To use process_in_background
49 47
50 48 In your model:
13 lib/backgrounder/delay_storage.rb → lib/backgrounder/delay.rb
@@ -2,13 +2,20 @@ module CarrierWave
2 2 module Backgrounder
3 3
4 4 module DelayStorage
  5 + def self.included(klass)
  6 + klass.send :include, Delay
  7 + Logger.warn "Carrierwave::Backgrounder::DelayStorage is deprecated, use Carrierwave::Backgrounder::Delay instead"
  8 + end
  9 + end
  10 +
  11 + module Delay
5 12
6 13 ##
7   - #Intercept carrierwave#cache_versions! so we can process versions later.
  14 + # Intercept carrierwave#cache_versions! so we can process versions later.
8 15 def cache_versions!(new_file)
9 16 super(new_file) if proceed_with_versioning?
10 17 end
11   -
  18 +
12 19 def process!(new_file=nil)
13 20 super(new_file) if proceed_with_versioning?
14 21 end
@@ -18,7 +25,7 @@ def process!(new_file=nil)
18 25 def proceed_with_versioning?
19 26 !model.respond_to?(:"process_#{mounted_as}_upload") || model.send(:"process_#{mounted_as}_upload")
20 27 end
21   - end # DelayStorage
  28 + end # Delay
22 29
23 30 end # Backgrounder
24 31 end # CarrierWave
5 lib/carrierwave_backgrounder.rb
... ... @@ -1,6 +1,9 @@
1 1 module CarrierWave
2 2 module Backgrounder
3   - autoload :DelayStorage, 'backgrounder/delay_storage'
  3 + Logger = Logger.new(STDOUT)
  4 +
  5 + autoload :Delay, 'backgrounder/delay'
  6 + autoload :DelayStorage, 'backgrounder/delay'
4 7
5 8 module ORM
6 9 autoload :Base, 'backgrounder/orm/base'

0 comments on commit d966152

Please sign in to comment.
Something went wrong with that request. Please try again.