Skip to content

Commit 96831c1

Browse files
committed
Support components by ensuring we remove any extra 'models' directories in the path and model names
1 parent c0aa6ca commit 96831c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/annotate/annotate_models.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@ def get_model_class(file)
584584
begin
585585
get_loaded_model(model_path, file) || raise(BadModelFileError.new)
586586
rescue LoadError
587+
if model_path.include?("models/")
588+
model_path = model_path.gsub(/models\//, '')
589+
retry
590+
end
587591
# this is for non-rails projects, which don't get Rails auto-require magic
588592
file_path = File.expand_path(file)
589593
if File.file?(file_path) && Kernel.require(file_path)

0 commit comments

Comments
 (0)