Setitng custom field values doesn't work with Paranoia

223 Views Asked by At

I have been trying to set up Paranoia with my project. I have a deleted_at column and another column status which is equal to 2 when it's deleted.

Model Class

class Account < ActiveRecord::Base

  acts_as_paranoid column: :status, sentinel_value: 1

  def paranoia_restore_attributes
    {
      deleted_at: nil,
      status: 1
    }
  end

  def paranoia_destroy_attributes
    {
      deleted_at: current_time_from_proper_timezone,
      status: 2
    }
  end 
end

But when I perform destroy or restore, it doesn't seem to change the status value.

0

There are 0 best solutions below