Skip to content

Commit

Permalink
separates deletion_time from paranoia_column_value (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
sas1ni69 committed Mar 23, 2022
1 parent e7c5a34 commit e1dd15d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/paranoia.rb
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 e1dd15d

Please sign in to comment.