lib/elasticsearch/model/naming.rb in elasticsearch-model-6.1.2 vs lib/elasticsearch/model/naming.rb in elasticsearch-model-7.0.0.pre

- old
+ new

@@ -1,5 +1,22 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + module Elasticsearch module Model # Provides methods for getting and setting index name and document type for the model # @@ -77,16 +94,11 @@ def implicit(prop) value = nil if Elasticsearch::Model.settings[:inheritance_enabled] self.ancestors.each do |klass| - # When Naming is included in Proxy::ClassMethods the actual model - # is among its ancestors. We don't want to call the actual model - # since it will result in the same call to the same instance of - # Proxy::ClassMethods. To prevent this we also skip the ancestor - # that is the target. - next if klass == self || self.respond_to?(:target) && klass == self.target + next if klass == self break if value = klass.respond_to?(prop) && klass.send(prop) end end value || self.send("default_#{prop}") @@ -94,13 +106,10 @@ def default_index_name self.model_name.collection.gsub(/\//, '-') end - def default_document_type - DEFAULT_DOC_TYPE - end - + def default_document_type; end end module InstanceMethods # Get or set the index name for the model instance