3
我想要做這樣的事情:包括一個混合內混入
module Mixin
def self.included(base)
base.include AnotherMixin
...
end
end
這給錯誤
NoMethodError - private method `include' called for Class
我如何可以包括一個mixin一個mixin在裏面使用我正在定義的方法?
只是刪除從'base.include AnotherMixin'了'base' ...它將工作。 –
@ArupRakshit - 它將包含AnotherMixin withn Mixin - 嘗試使用'included_modules'檢查它 – BroiSatse
@BroiSatse *如何在mixin中包含mixin *意味着什麼? –