state-machines / state_machines

Adds support for creating state machines for attributes on any Ruby class
https://github.com/state-machines/state_machines
MIT License
814 stars 91 forks source link

gems/state_machines-0.5.0/lib/state_machines/integrations/base.rb:27:in `<=': compared with non class/module (TypeError) #62

Closed NielsKSchjoedt closed 6 years ago

NielsKSchjoedt commented 6 years ago

This occurs when trying to run specs in my rails engine gem where I use state_machines-activerecord, which uses state_machines. No ida why it happens?

Inspecting the output of the method like so:

        # Whether the integration should be used for the given class.
        def matches?(klass)
          matching_ancestors.any? { |ancestor|
            puts "#{klass.inspect} >< #{ancestor.inspect}"
            klass <= ancestor
          }
        end

I get:

DataCollecting::CollectorRun (call 'DataCollecting::CollectorRun.connection' to establish a connection) >< "ActiveRecord::Base"

DataCollecting is one of the classes I use for state_machines

NielsKSchjoedt commented 6 years ago

Seems like state_machines-activerecord was the sinner here: https://github.com/state-machines/state_machines-activerecord/issues/65