Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/non timestamp sentinel value #532

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting

end
end
end
Expand Down