Skip to content

Commit

Permalink
separates deletion_time from paranoia_column_value (rubysherpas#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
sas1ni69 authored and arun-zc committed Feb 6, 2024
1 parent 251aaa2 commit b96d81e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def within_recovery_window?(recovery_window_range)
end

def paranoia_destroyed?
deletion_time != paranoia_sentinel_value
paranoia_column_value != paranoia_sentinel_value
end
alias :deleted? :paranoia_destroyed?

Expand Down Expand Up @@ -296,12 +296,16 @@ def paranoia_column
self.class.paranoia_column
end

def paranoia_column_value
send(paranoia_column)
end

def paranoia_sentinel_value
self.class.paranoia_sentinel_value
end

def deletion_time
send(paranoia_column)
paranoia_column_value.acts_like?(:time) ? paranoia_column_value : deleted_at
end
end
end
Expand Down

0 comments on commit b96d81e

Please sign in to comment.