dkubb / axiom

Simplifies querying of structured data using relational algebra
https://github.com/dkubb/axiom
MIT License
457 stars 22 forks source link

Problem with Axiom and ActiveSupport (Rails 4.0.1) #50

Closed swistaczek closed 10 years ago

swistaczek commented 10 years ago

Hello, During 'grape' gem integration (rack API framework) and Mongoid I encountered an issue with ActiveSupport and Axiom. Final stacktrace occurs while calling Class that is including Mongoid::Document.

ArgumentError: comparison of Class with Class failed
    from org/jruby/RubyComparable.java:168:in `<'
    from /Users/ernest.bursa/.rvm/gems/jruby-1.7.6@ayeappz/gems/activesupport-4.0.1/lib/active_support/core_ext/class/subclasses.rb:19:in `descendants'
    from org/jruby/RubyObjectSpace.java:173:in `each_object'
...

I have examined that there is problem with class Axiom::Types::Infinity. That class can not be compared to other classes (done by ActiveSupport in subclasses.rb)

Excerpt from subclasses.rb:

    def descendants # :nodoc:
...
  rescue StandardError # JRuby
    def descendants # :nodoc:
      descendants = []
      ObjectSpace.each_object(Class) do |k|
        descendants.unshift k if k < self # fails here
      end
      descendants.uniq!
      descendants
    end
  end

Are we able to make Axiom::Types::Infinity comparable?

dkubb commented 10 years ago

This was resolved in https://github.com/dkubb/axiom-types/issues/8