Skip to content

Commit 6356fdc

Browse files
committed
[MODEL] Register the included hook for "Importing" module in the main scope
1 parent 49bacc0 commit 6356fdc

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

elasticsearch-model/lib/elasticsearch/model/importing.rb

+16-13
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ module Model
88
#
99
module Importing
1010

11-
module ClassMethods
11+
# When included in a model, adds the importing methods.
12+
#
13+
# @example Import all records from the `Article` model
14+
#
15+
# Article.import
16+
#
17+
# @see #import
18+
#
19+
def self.included(base)
20+
base.__send__ :extend, ClassMethods
1221

13-
# When included in a model, adds the importing methods.
14-
#
15-
# @example Import all records from the `Article` model
16-
#
17-
# Article.import
18-
#
19-
# @see #import
20-
#
21-
def self.included(base)
22-
adapter = Adapter.from_class(base)
23-
base.__send__ :include, adapter.importing_mixin
24-
end
22+
adapter = Adapter.from_class(base)
23+
base.__send__ :include, adapter.importing_mixin
24+
base.__send__ :extend, adapter.importing_mixin
25+
end
26+
27+
module ClassMethods
2528

2629
# Import all model records into the index
2730
#

0 commit comments

Comments
 (0)