How to clear all data in a particular table

Premise

I was putting data in db / seed. I want to change the data, so I decided to delete it.

csv file data image.png

Method

rsils c

Food.all.destroy_all

Commentary

Use destroy_all to delete multiple data.

result

image.png

Referenced site

https://www.sejuku.net/blog/63480

Recommended Posts

How to clear all data in a particular table
How to store Rakuten API data in a table
How to create a data URI (base64) in Java
How to make a unique combination of data in the rails intermediate table
How to add columns to a table
SDWebImage: How to clear the cache for a particular UIImageView
How to get date data in Ruby
How to insert a video in Rails
[RubyOnRails] How to implement pull-down in form_with based on table data
How to publish a library in jCenter
How to overwrite Firebase data in Swift
How to display a web page in Java
Delete all records in a MySQL database table
How to run a djUnit task in Ant
How to add a classpath in Spring Boot
How to create a theme in Liferay 7 / DXP
How to implement a like feature in Rails
How to easily create a pull-down in Rails
(Ruby on Rails6) Creating data in a table
How to make a follow function in Rails
How to automatically generate a constructor in Eclipse
How to fix a crash when deleting Realm data in Swift UI List
How to store data simultaneously in a model associated with a nested form (Rails 6.0.0)
How to create a Java environment in just 3 seconds
How to implement a like feature in Ajax in Rails
How to create a Spring Boot project in IntelliJ
How to launch another command in a Ruby program
How to display a browser preview in VS Code
[How to insert a video in haml with Rails]
How to write a date comparison search in Rails
How to mock a super method call in PowerMock
How to convert A to a and a to A using AND and OR in Java
How to convert a file to a byte array in Java
[Rails 6] How to set a background image in Rails [CSS]
[Rails] How to load JavaScript in a specific view
How to write a core mod in Minecraft Forge 1.15.2
[Ruby/Rails] How to generate a password in a regular expression
Extract all data about a particular user with ActiveRecord
How to leave a comment
How to insert a video
How to create a method
How to use JSON data in WebSocket communication (Java, JavaScript)
How to change a string in an array to a number in Ruby
How to create a placeholder part to use in the IN clause
Solved the problem that all the data in the table was displayed
How to store a string from ArrayList to String in Java (Personal)
How to run npm install on all projects in Lerna
How to select a specified date by code in FSCalendar
How to display a graph in Ruby on Rails (LazyHighChart)
How to add the same Indexes in a nested array
Mapping to a class with a value object in How to MyBatis
How to develop and register a Sota app in Java
How to simulate uploading a post-object form to OSS in Java
How to join a table without using DBFlute and sql
How to create a service builder portlet in Liferay 7 / DXP
How to set up a proxy with authentication in Feign
How to use Lombok in Spring
How to find May'n in XPath
How to hide scrollbars in WebView
How to run JUnit in Eclipse
How to iterate infinitely in Ruby