Truncate database in Ruby on Rails 6
Instead of chaining rails db:drop, rails db:create and rails db:migrate we are finally able to use one command that will clean database in case you have to seed it one more time:
1
rails db:truncate_all
 
NOTE: In older versions of Rails, you can always use the database_cleaner gem. Thanks to this gem you can run DatabaseCleaner.clean_with :truncation in rails console or create a rake task on your own.
 What is Rake?
Rake is a build automation tool written in Ruby. It allows you to automate tasks such as running tests, migrating databases, and more.
Rails uses Rake for running various tas...
 What is Rake?
Rake is a build automation tool written in Ruby. It allows you to automate tasks such as running tests, migrating databases, and more.
Rails uses Rake for running various tas...