Skip to content

Commit 8004adc

Browse files
committed
restore PR#50 - see cfeec96
1 parent 935b435 commit 8004adc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/annotate/annotate_models.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ def get_model_files(options)
361361
# in subdirectories without namespacing.
362362
def get_model_class(file)
363363
# this is for non-rails projects, which don't get Rails auto-require magic
364-
require File.expand_path("#{model_dir}/#{file}")
365-
364+
require File.expand_path("#{model_dir}/#{file}") unless Module.const_defined?(:Rails)
366365
model_path = file.gsub(/\.rb$/, '')
367366
get_loaded_model(model_path) || get_loaded_model(model_path.split('/').last)
368367
end

0 commit comments

Comments
 (0)