Skip to content

Instantly share code, notes, and snippets.

@mrpunkin
Created March 8, 2014 04:02
Show Gist options
  • Select an option

  • Save mrpunkin/9425143 to your computer and use it in GitHub Desktop.

Select an option

Save mrpunkin/9425143 to your computer and use it in GitHub Desktop.
FooJob = Struct.new(:shop_id) do
def perform
## code ##
end
include ShopifyJobHooks
end
module ShopifyJobHooks
extend ActiveSupport::Concern
included do
attr_accessor :shop
alias_method :_perform, :perform
def perform
self.shop = Shop.find(shop_id)
shop.session do
sleep ShopifyAPI.credit_used
_perform
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment