File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
activerecord/lib/active_record Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -969,9 +969,7 @@ def connection
969
969
end
970
970
971
971
def method_missing ( method , *arguments , &block )
972
- arg_list = arguments . map ( &:inspect ) * ", "
973
-
974
- say_with_time "#{ method } (#{ arg_list } )" do
972
+ say_with_time "#{ method } (#{ format_arguments ( arguments ) } )" do
975
973
unless connection . respond_to? :revert
976
974
unless arguments . empty? || [ :execute , :enable_extension , :disable_extension ] . include? ( method )
977
975
arguments [ 0 ] = proper_table_name ( arguments . first , table_name_options )
@@ -1080,6 +1078,22 @@ def execute_block
1080
1078
end
1081
1079
end
1082
1080
1081
+ def format_arguments ( arguments )
1082
+ arg_list = arguments [ 0 ...-1 ] . map ( &:inspect )
1083
+ last_arg = arguments . last
1084
+ if last_arg . is_a? ( Hash )
1085
+ last_arg = last_arg . reject { |k , _v | internal_option? ( k ) }
1086
+ arg_list << last_arg . inspect unless last_arg . empty?
1087
+ else
1088
+ arg_list << last_arg . inspect
1089
+ end
1090
+ arg_list . join ( ", " )
1091
+ end
1092
+
1093
+ def internal_option? ( option_name )
1094
+ option_name . start_with? ( "_" )
1095
+ end
1096
+
1083
1097
def command_recorder
1084
1098
CommandRecorder . new ( connection )
1085
1099
end
You can’t perform that action at this time.
0 commit comments