You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Charlie O'Keefe edited this page Jun 30, 2015
·
3 revisions
DISCLAIMER: I believe this is bad advice except for very specific conditions when using MySQL. I recommend against it unless you notice performance problems in your production dataset on your production database. - jhawthorn
Some (FIXME: which?) databases ignore null columns when it comes to resolving unique index
constraints. This means unique constraints that involve nullable columns may be
problematic. Instead of using NULL to represent a not-deleted row, you can pick
a value that you want paranoia to mean not deleted. Note that you can/should
now apply a NOT NULL constraint to your deleted_at column.
Per model:
# pick some valueacts_as_paranoidsentinel_value: DateTime.new(0)
or globally in a rails initializer, e.g. config/initializer/paranoia.rb