We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0caccf1 commit 4384721Copy full SHA for 4384721
lib/annotate/annotate_models.rb
@@ -481,7 +481,7 @@ def get_model_class(file)
481
rescue LoadError
482
# this is for non-rails projects, which don't get Rails auto-require magic
483
file_path = File.expand_path(file)
484
- if File.file?(file_path) && Kernel.require(file_path)
+ if File.file?(file_path) && silence_warnings { Kernel.require(file_path) }
485
retry
486
elsif model_path.match(/\//)
487
model_path = model_path.split('/')[1..-1].join('/').to_s
@@ -612,5 +612,13 @@ def classified_sort(cols)
612
613
return ([id] << rest_cols << timestamps << associations).flatten
614
end
615
+
616
+ # Ignore warnings for the duration of the block ()
617
+ def silence_warnings
618
+ old_verbose, $VERBOSE = $VERBOSE, nil
619
+ yield
620
+ ensure
621
+ $VERBOSE = old_verbose
622
+ end
623
624
0 commit comments