diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-18 00:21:40 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-18 00:21:40 +0900 |
commit | b707a448a34345cd0a6609b8bd57874f1325a96c (patch) | |
tree | 7cf62618b531886fe8caa9c4fac3d691684b41fe /activerecord/lib/active_record/tasks | |
parent | d8d6bd5e63a9a4a6c06a4dde3c7137ee2be105fd (diff) | |
download | rails-b707a448a34345cd0a6609b8bd57874f1325a96c.tar.gz rails-b707a448a34345cd0a6609b8bd57874f1325a96c.tar.bz2 rails-b707a448a34345cd0a6609b8bd57874f1325a96c.zip |
Tweak `truncate_tables`
* Remove redundant `table_names.empty?`
* Early return in `truncate_tables` since it is already deeply nested
* Move `truncate_tables` out from between `exec_delete` and `exec_update`
Diffstat (limited to 'activerecord/lib/active_record/tasks')
-rw-r--r-- | activerecord/lib/active_record/tasks/database_tasks.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index f18990cc5b..155d2b0b98 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -190,7 +190,7 @@ module ActiveRecord ActiveRecord::Base.internal_metadata_table_name ] - ActiveRecord::Base.connection.truncate_tables(*table_names) unless table_names.empty? + ActiveRecord::Base.connection.truncate_tables(*table_names) end end private :truncate_tables |