假设我有以下命名空间,其中一个Base
模块定义了一些可以重用的方法
module MyNameSpace
module Magic
extend ActiveSupport::Concern
class_methods do
def magic_field(field_name)
# Defines methods and attributes based on field name
end
end
end
end
有什么区别(如果有的话)
module MyNameSpace
module Foo
extend ActiveSupport::Concern
include Magic
included do
magic_field(:foo)
end
end
end
和
module MyNameSpace
module Foo
extend ActiveSupport::Concern
included do
include Magic
magic_field(:foo)
end
end
end
(问题是关于include Magic
在街区外或在街区内的区别included
)