-
-
Save brunomichetti/ea6c41e5473d9e808e5c7f7bf59a4d41 to your computer and use it in GitHub Desktop.
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 CCRecalculationEnqueuer < CCEnqueuer | |
def perform | |
class_to_update = @options[:relation_class_name].constantize | |
instance_id = @options[:relation_id] | |
instance = class_to_update.public_send(:find, instance_id) | |
method_name = @options[:method] | |
instance.public_send(method_name.to_sym) | |
unmark_as_queued | |
end | |
private | |
def enqueuer_name | |
'recalculation' | |
end | |
def form_key | |
class_name = @options[:relation_class_name] | |
column_name = @options[:column] | |
instance_id = @options[:relation_id] | |
"cc::#{class_name}::#{instance_id}::#{column_name}::recalculation" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment