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)
481481 rescue LoadError
482482 # this is for non-rails projects, which don't get Rails auto-require magic
483483 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 ) }
485485 retry
486486 elsif model_path . match ( /\/ / )
487487 model_path = model_path . split ( '/' ) [ 1 ..-1 ] . join ( '/' ) . to_s
@@ -612,5 +612,13 @@ def classified_sort(cols)
612612
613613 return ( [ id ] << rest_cols << timestamps << associations ) . flatten
614614 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
615623 end
616624end
You can’t perform that action at this time.
0 commit comments