Created
March 28, 2019 12:54
-
-
Save simoleone/adf09f30176b478f9cf2a933ba9f697a to your computer and use it in GitHub Desktop.
Async image processing in Shrine
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
Shrine.plugin :backgrounding | |
Shrine::Attacher.promote { |data| ShrinePromoteWorker.perform_async(data) } | |
Shrine::Attacher.delete { |data| ShrineDeleteWorker.perform_async(data) } |
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
class ShrineDeleteWorker < ApplicationWorker | |
def perform(data) | |
Shrine::Attacher.delete(data) | |
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
class ShrinePromoteWorker < ApplicationWorker | |
def perform(data) | |
Shrine::Attacher.promote(data) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment