Skip to content

Commit 0f8a3bd

Browse files
authored
📝 Add Yard documentation for Paranoia::Query (#555)
1 parent f68cb23 commit 0f8a3bd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: lib/paranoia.rb

+3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ def self.included(klazz)
2424
module Query
2525
def paranoid? ; true ; end
2626

27+
# If you want to find all records, even those which are deleted
2728
def with_deleted
2829
if ActiveRecord::VERSION::STRING >= "4.1"
2930
return unscope where: paranoia_column
3031
end
3132
all.tap { |x| x.default_scoped = false }
3233
end
3334

35+
# If you want to find only the deleted records
3436
def only_deleted
3537
if paranoia_sentinel_value.nil?
3638
return with_deleted.where.not(paranoia_column => paranoia_sentinel_value)
@@ -45,6 +47,7 @@ def only_deleted
4547
end
4648
alias_method :deleted, :only_deleted
4749

50+
# If you want to restore a record
4851
def restore(id_or_ids, opts = {})
4952
ids = Array(id_or_ids).flatten
5053
any_object_instead_of_id = ids.any? { |id| ActiveRecord::Base === id }

0 commit comments

Comments
 (0)