-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement of cache* method for carrierwave 2.0
- Loading branch information
Showing
9 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ test/tmp | |
test/version_tmp | ||
tmp | ||
uploads/ | ||
.idea/ | ||
.rakeTasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# encoding: utf-8 | ||
module Carrierwave | ||
module Qiniu | ||
VERSION = "1.2.0" | ||
VERSION = "1.2.1" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,21 @@ | ||
#encoding: utf-8 | ||
module CarrierWave | ||
|
||
class SanitizedFile | ||
|
||
attr_accessor :copy_from_path | ||
|
||
end | ||
|
||
module Uploader | ||
module Cache | ||
|
||
alias_method :old_cache!, :cache! | ||
|
||
def cache!(new_file = sanitized_file) | ||
|
||
old_cache! new_file | ||
|
||
if new_file.kind_of? CarrierWave::Storage::Qiniu::File | ||
@file.copy_from_path = new_file.path | ||
elsif new_file.kind_of? CarrierWave::Uploader::Base | ||
return unless new_file.file.present? | ||
@file.copy_from_path = new_file.file.path | ||
@file.copy_from_path = new_file.file.path if @file.respond_to?(:copy_from_path) | ||
end | ||
|
||
end | ||
end | ||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters