期望X定义Y - 类和具有相同名称的模块

时间:2013-07-14 18:31:51

标签: ruby ruby-on-rails-3

我有这个:

# /app/events/account_cancelled.rb:
module Events
  class AccountCancelled < Base::TrackEvent

#/app/events/base/track_event.rb:
module Events
  module Base
    class TrackEvent < Event

#/app/services/website/base.rb:
module Services
  module Website
    class Base

我收到错误:

Expected <snip>/app/services/website/base.rb to define Base
   from <snip>/app/events/account_cancelled.rb:2

我试图完全限定AccountCancelled的类定义:

module Events
  class AccountCancelled < Events::Base::TrackEvent

但我得到完全相同的错误。顺便说一下,在我将所有这些内容从lib移到app之前,一切正常。这是怎么回事?

更新

我也尝试从::Events::Base::TrackEvent继承。同样的错误。

1 个答案:

答案 0 :(得分:-1)

/app/events/account_cancelled.rb预计::BaseEvents::Base,但是 /app/services/website/base.rb:给出Services::Website::Base。他们不匹配。