Skip to content

Commit

Permalink
WIP: Adds #only_active scope
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesfostie committed Jun 3, 2015
1 parent bc515d1 commit 8707eac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def only_deleted
end
alias :deleted :only_deleted

def only_active
where(paranoia_column => nil)
end

def restore(id_or_ids, opts = {})
ids = Array(id_or_ids).flatten
any_object_instead_of_id = ids.any? { |id| ActiveRecord::Base === id }
Expand Down

0 comments on commit 8707eac

Please sign in to comment.