Rails record locking

Years ago, I used acts_as_paranoid to prevent records from being actually deleted.I still like the idea of rather “locking” and hiding records instead of deleting them in some cases, e.g. not to lose references to them for other old records.

As the locking/unlocking procedure is the same for every model, I created a small module which encapsulates the functionality.To use it, simply include the module in your model:

include Lockable