Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/paranoia.rb
Class Method Summary collapse
Instance Method Summary collapse
- #paranoid? ⇒ Boolean
-
#persisted? ⇒ Boolean
Override the persisted method to allow for the paranoia gem.
Class Method Details
.acts_as_paranoid ⇒ Object
45 46 47 48 49 50 |
# File 'lib/paranoia.rb', line 45 def self.acts_as_paranoid alias :destroy! :destroy alias :delete! :delete include Paranoia default_scope { where(:deleted_at => nil) } end |
.paranoid? ⇒ Boolean
52 |
# File 'lib/paranoia.rb', line 52 def self.paranoid? ; false ; end |
Instance Method Details
#paranoid? ⇒ Boolean
53 |
# File 'lib/paranoia.rb', line 53 def paranoid? ; self.class.paranoid? ; end |
#persisted? ⇒ Boolean
Override the persisted method to allow for the paranoia gem. If a paranoid record is selected, then we only want to check if it’s a new record, not if it is “destroyed”.
58 59 60 |
# File 'lib/paranoia.rb', line 58 def persisted? paranoid? ? !new_record? : super end |