module Spree::Backend::Callbacks

Protected Instance Methods

invoke_callbacks(action, callback_type) click to toggle source
# File lib/spree/backend/callbacks.rb, line 35
def invoke_callbacks(action, callback_type)
  callbacks = self.class.callbacks || {}
  return if callbacks[action].nil?

  case callback_type.to_sym
  when :before then callbacks[action].before_methods.each { |method| send method }
  when :after  then callbacks[action].after_methods.each  { |method| send method }
  when :fails  then callbacks[action].fails_methods.each  { |method| send method }
  end
end