diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 709b5f95f..145a43806 100755 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -386,7 +386,8 @@ def get_model_class(file) get_loaded_model(model_path) or raise LoadError.new("cannot load a model from #{file}") rescue LoadError # this is for non-rails projects, which don't get Rails auto-require magic - if Kernel.require(file) + file_path = File.expand_path(file) + if File.file?(file_path) && Kernel.require(file_path) retry elsif model_path.match(/\//) model_path = model_path.split('/')[1..-1].join('/').to_s