Rails与继承不匹配

时间:2015-07-27 22:32:48

标签: ruby-on-rails inheritance activesupport type-mismatch

我遇到了以下设置不匹配的问题。

class FooBar
end

module Foo
  class Bar < FooBar
  end
end

module Foo
  class Bar  # This throws class mismatch because 'Bar' != 'Bar < FooBar'
    class Abc
    end
  end
end

似乎有:

module Foo
  class Bar < FooBar
    class Abc
    end
  end
end

理论上应该工作但我仍然会收到以下输出错误:

<module:Foo>: superclass mismatch for class Bar (TypeError)

from /Users/amat/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in require

0 个答案:

没有答案