-
-
Save yfkhar/4b44ed4b12be7a077f17aa99448da70f to your computer and use it in GitHub Desktop.
Async image processing in Shrine
This file contains hidden or 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 hidden or 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 hidden or 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