Skip to content

Commit b428635

Browse files
authored
[MODEL] Remove deprecation warning and functionality for Single Table Inheritance (#900)
1 parent da79b17 commit b428635

File tree

4 files changed

+1
-268
lines changed

4 files changed

+1
-268
lines changed

elasticsearch-model/lib/elasticsearch/model.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,36 +172,11 @@ def search(query_or_payload, models=[], options={})
172172
Response::Response.new(models, request)
173173
end
174174

175-
# Check if inheritance is enabled
176-
#
177-
# @note Inheritance is disabled by default.
178-
#
179-
def inheritance_enabled
180-
@settings[:inheritance_enabled] ||= false
181-
end
182-
183-
# Enable inheritance of index_name and document_type
184-
#
185-
# @example Enable inheritance
186-
#
187-
# Elasticsearch::Model.inheritance_enabled = true
188-
#
189-
def inheritance_enabled=(inheritance_enabled)
190-
warn STI_DEPRECATION_WARNING if inheritance_enabled
191-
@settings[:inheritance_enabled] = inheritance_enabled
192-
end
193-
194175
# Access the module settings
195176
#
196177
def settings
197178
@settings ||= {}
198179
end
199-
200-
private
201-
202-
STI_DEPRECATION_WARNING = "DEPRECATION WARNING: Support for Single Table Inheritance (STI) is deprecated " +
203-
"and will be removed in version 7.0.0.\nPlease save different model documents in separate indices and refer " +
204-
"to the Elasticsearch documentation for more information.".freeze
205180
end
206181
extend ClassMethods
207182

elasticsearch-model/lib/elasticsearch/model/naming.rb

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,7 @@ def document_type=(name)
9292
private
9393

9494
def implicit(prop)
95-
value = nil
96-
97-
if Elasticsearch::Model.settings[:inheritance_enabled]
98-
self.ancestors.each do |klass|
99-
# When Naming is included in Proxy::ClassMethods the actual model
100-
# is among its ancestors. We don't want to call the actual model
101-
# since it will result in the same call to the same instance of
102-
# Proxy::ClassMethods. To prevent this we also skip the ancestor
103-
# that is the target.
104-
next if klass == self || self.respond_to?(:target) && klass == self.target
105-
break if value = klass.respond_to?(prop) && klass.send(prop)
106-
end
107-
end
108-
109-
value || self.send("default_#{prop}")
95+
self.send("default_#{prop}")
11096
end
11197

11298
def default_index_name

elasticsearch-model/spec/elasticsearch/model/module_spec.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,5 @@ def self.search(query, options={})
8989
expect(Elasticsearch::Model.settings[:foo]).to eq('bar')
9090
end
9191
end
92-
93-
context 'when \'inheritance_enabled\' is set' do
94-
95-
around do |example|
96-
original_value = Elasticsearch::Model.settings[:inheritance_enabled]
97-
example.run
98-
Elasticsearch::Model.settings[:inheritance_enabled] = original_value
99-
end
100-
101-
context 'when \'inheritance_enabled\' is true' do
102-
103-
it 'warns with a deprecation message' do
104-
expect(Elasticsearch::Model).to receive(:warn)
105-
Elasticsearch::Model.inheritance_enabled = true
106-
end
107-
end
108-
109-
context 'when \'inheritance_enabled\' is false' do
110-
111-
it 'does not warn' do
112-
expect(Elasticsearch::Model).not_to receive(:warn)
113-
Elasticsearch::Model.inheritance_enabled = false
114-
end
115-
end
116-
end
11792
end
11893
end

elasticsearch-model/spec/elasticsearch/model/naming_inheritance_spec.rb

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)