Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/annotate/annotate_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down