diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 1d84b794..ac214ffb 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -618,9 +618,7 @@ def get_loaded_model(model_path, file) # Retrieve loaded model class by path to the file where it's supposed to be defined. def get_loaded_model_by_path(model_path) - klass = ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path)) - - klass if klass.is_a?(Class) && klass < ActiveRecord::Base + ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path)) rescue StandardError, LoadError # Revert to the old way but it is not really robust ObjectSpace.each_object(::Class)