0

Is it possible to have the

include Elasticsearch::Model
include Elasticsearch::Model::Callbacks

on a module? and how so?

1 Answer 1

2

You may use included block of ActiveSupport::Concern to include these modules

Something like:

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
Sign up to request clarification or add additional context in comments.

1 Comment

My one challenge is in my code I would have extend instead of include for MyElasticSupport

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.