From 54dce6870de23110cdf251d8f71a8e1a57dea7bb Mon Sep 17 00:00:00 2001 From: Ryo Hashimoto Date: Mon, 8 Apr 2019 12:22:54 +0900 Subject: Improve log messages for #insert_all` / `#upsert_all` / `#insert` / `#upsert etc. methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In #35077, `#insert_all` / `#upsert_all` / `#insert` / `#upsert` etc. methods are added. But Active Record logs only “Bulk Insert” log messages when they are invoked. This commit improves the log messages to use collect words for how invoked them. --- activerecord/lib/active_record/insert_all.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/insert_all.rb b/activerecord/lib/active_record/insert_all.rb index 4b02d40aa0..7e28b66663 100644 --- a/activerecord/lib/active_record/insert_all.rb +++ b/activerecord/lib/active_record/insert_all.rb @@ -21,7 +21,10 @@ module ActiveRecord end def execute - connection.exec_query to_sql, "Bulk Insert" + message = "#{model} " + message += "Bulk " if inserts.many? + message += (on_duplicate == :update ? "Upsert" : "Insert") + connection.exec_query to_sql, message end def updatable_columns -- cgit v1.2.3