# File lib/state_machine/machine.rb, line 1718
      def owner_class_ancestor_has_method?(scope, method)
        superclasses = owner_class.ancestors[1..-1].select {|ancestor| ancestor.is_a?(Class)}
        
        if scope == :class
          # Use singleton classes
          current = (class << owner_class; self; end)
          superclass = superclasses.first
        else
          current = owner_class
          superclass = owner_class.superclass
        end
        
        # Generate the list of modules that *only* occur in the owner class, but
        # were included *prior* to the helper modules, in addition to the
        # superclasses
        ancestors = current.ancestors - superclass.ancestors + superclasses
        ancestors = ancestors[ancestors.index(@helper_modules[scope]) + 1..-1].reverse
        
        # Search for for the first ancestor that defined this method
        ancestors.detect do |ancestor|
          ancestor = (class << ancestor; self; end) if scope == :class && ancestor.is_a?(Class)
          ancestor.method_defined?(method) || ancestor.private_method_defined?(method)
        end
      end