def filter_actions_by_only_exclude(callbacks, action)
      callbacks.select do |callback, options|
        if options && (only = options[:only])
          # If there is an only, make sure the action is in the list.
          [only].flatten.include?(action.to_sym)
        else
          # If no only, include it
          true
        end
      end
    end
def filter_actions_by_only_exclude(callbacks, action)
      callbacks.select do |callback, options|
        if options && (only = options[:only])
          # If there is an only, make sure the action is in the list.
          [only].flatten.include?(action.to_sym)
        else
          # If no only, include it
          true
        end
      end
    end
TODO: currently we filter during the call, we could maybe improve performance
 here by storing by action and having an all category as well.