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
      66 67 68 69 70 71  | 
    
      # File 'lib/paranoia.rb', line 66 def self.acts_as_paranoid alias :destroy! :destroy alias :delete! :delete include Paranoia default_scope { where(self.quoted_table_name + '.deleted_at IS NULL') } end  | 
  
.paranoid? ⇒ Boolean
      73  | 
    
      # File 'lib/paranoia.rb', line 73 def self.paranoid? ; false ; end  | 
  
Instance Method Details
#paranoid? ⇒ Boolean
      74  | 
    
      # File 'lib/paranoia.rb', line 74 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”.
      79 80 81  | 
    
      # File 'lib/paranoia.rb', line 79 def persisted? paranoid? ? !new_record? : super end  |