0.0
No commit activity in last 3 years
No release in over 3 years
This is a gem to let deleted records rest in peace. :coffin:
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.5.2
~> 1.1.3
>= 0

Runtime

< 6.0, >= 4.2
 Project Readme

Records, R.I.P.

Build Status Gem Version

This gem is a place to let deleted records rest in peace. ⚰️

Soft deletes are evil. Blest be y man y spares thes stones. And curst be he y moves my bones.

Getting Started

Add this line to your application’s Gemfile:

gem 'records_rip'

Add a tombs table to your database:

rails generate records_rip:install
rake db:migrate

Add rest_in_peace to the models you want to visit the tomb.

class User < ApplicationRecord
  rest_in_place
end

Scopes

You can perform WHERE queries for tombs#epitaph based on attributes:

user = User.create(name: 'Smith')
user.destroy

User.tomb(name: 'Smith').to_a
# => [#<RecordsRip::Tomb id: 1, item_type: "User", item_id: 1, epitaph: "{\"id\"=>1, \"name\"=>\"Smith\"}">]

Change serialization method

class User < ApplicationRecord
  rest_in_place {|record| Hash[record.attributes.map {|k, v| [k, "Great #{v}"]}] }
end

user = User.create(name: 'Smith')
user.destroy

User.tomb(name: 'Great Smith').to_a
# => [#<RecordsRip::Tomb id: 1, item_type: "User", item_id: 1, epitaph: "{\"id\"=>1, \"name\"=>\"Great Smith\"}">]

Greater libraries

If you need perfect audit logs, I recommend you to use paper_trail gem.

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: