是否有可能拥有
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
在一个模块上?怎么样?
最佳答案
您可以使用 included
ActiveSupport::Concern block 包括这些模块
就像是:
module MyElasticSupport
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
end
... some other code ...
end
class MyModel
include MyElasticSupport
... some other code ...
end
关于ruby-on-rails - Rails - 在模块上包含 Elasticsearch ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25313984/