简体   繁体   中英

how to implement softdelete in rails

I want to have a model where I need to soft delete a record and not show them in the find or any other conditions while searching.

I want to retain the model without deleting the record. How to go about this?

Thanks

添加带有迁移和范围的deleted字段,以过滤掉任何已删除的记录。

  1. Implement your own by creating nullable deleted_at date-time field in DB.
  2. Use one of these gems .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM