Ruby on rails 轨道-模块上是否包含elasticsearch?
有没有可能有Ruby on rails 轨道-模块上是否包含elasticsearch?,ruby-on-rails,ruby,
elasticsearch,Ruby On Rails,Ruby,
elasticsearch,有没有可能有 include Elasticsearch::Model include Elasticsearch::Model::Callbacks 在模块上?这是怎么回事?您可以使用的包含的块来包含这些模块 比如: module MyElasticSupport extend ActiveSupport::Concern included do include Elasticsearch::Model include Elasticsearch::Model::C
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
在模块上?这是怎么回事?您可以使用的
包含的块来包含这些模块
比如:
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
我的一个挑战是在我的代码中,对于MyLasticSupport,我将使用extend
而不是include