Skip to content

Commit

Permalink
Support components by ensuring we remove any extra 'models' directori…
Browse files Browse the repository at this point in the history
…es in the path and model names
  • Loading branch information
j-mutter committed Mar 22, 2022
1 parent c0aa6ca commit 96831c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/annotate/annotate_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ def get_model_class(file)
begin
get_loaded_model(model_path, file) || raise(BadModelFileError.new)
rescue LoadError
if model_path.include?("models/")
model_path = model_path.gsub(/models\//, '')
retry
end
# this is for non-rails projects, which don't get Rails auto-require magic
file_path = File.expand_path(file)
if File.file?(file_path) && Kernel.require(file_path)
Expand Down

0 comments on commit 96831c1

Please sign in to comment.