File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -481,7 +481,7 @@ def get_model_class(file)
481
481
rescue LoadError
482
482
# this is for non-rails projects, which don't get Rails auto-require magic
483
483
file_path = File . expand_path ( file )
484
- if File . file? ( file_path ) && Kernel . require ( file_path )
484
+ if File . file? ( file_path ) && silence_warnings { Kernel . require ( file_path ) }
485
485
retry
486
486
elsif model_path . match ( /\/ / )
487
487
model_path = model_path . split ( '/' ) [ 1 ..-1 ] . join ( '/' ) . to_s
@@ -612,5 +612,13 @@ def classified_sort(cols)
612
612
613
613
return ( [ id ] << rest_cols << timestamps << associations ) . flatten
614
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
615
623
end
616
624
end
You can’t perform that action at this time.
0 commit comments