aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/insert_all.rb
diff options
context:
space:
mode:
authorRyo Hashimoto <ryohashimoto@gmail.com>2019-04-08 12:22:54 +0900
committerRyo Hashimoto <ryohashimoto@gmail.com>2019-04-08 23:20:14 +0900
commit54dce6870de23110cdf251d8f71a8e1a57dea7bb (patch)
tree0f9bb56ed181ba7c37e9183c0c831555224f1d90 /activerecord/lib/active_record/insert_all.rb
parent57c7cbb1623c0e8befc58988a34bbb9896fd226a (diff)
downloadrails-54dce6870de23110cdf251d8f71a8e1a57dea7bb.tar.gz
rails-54dce6870de23110cdf251d8f71a8e1a57dea7bb.tar.bz2
rails-54dce6870de23110cdf251d8f71a8e1a57dea7bb.zip
Improve log messages for #insert_all` / `#upsert_all` / `#insert` / `#upsert etc. methods
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.
Diffstat (limited to 'activerecord/lib/active_record/insert_all.rb')
-rw-r--r--activerecord/lib/active_record/insert_all.rb5
1 files changed, 4 insertions, 1 deletions
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