class ActiveRecord::Base
Public Class Methods
I_AM_THE_DESTROYER!()
click to toggle source
Please do not use this method in production. Pretty please.
# File lib/paranoia.rb, line 270 def self.I_AM_THE_DESTROYER! # TODO: actually implement spelling error fixes puts %Q{ Sharon: "There should be a method called I_AM_THE_DESTROYER!" Ryan: "What should this method do?" Sharon: "It should fix all the spelling errors on the page!" } end
acts_as_paranoid(options={})
click to toggle source
# File lib/paranoia.rb, line 239 def self.acts_as_paranoid(options={}) define_model_callbacks :restore, :real_destroy alias_method :really_destroyed?, :destroyed? alias_method :really_delete, :delete alias_method :destroy_without_paranoia, :destroy include Paranoia class_attribute :paranoia_column, :paranoia_sentinel_value self.paranoia_column = (options[:column] || :deleted_at).to_s self.paranoia_sentinel_value = options.fetch(:sentinel_value) { Paranoia.default_sentinel_value } def self.paranoia_scope where(paranoia_column => paranoia_sentinel_value) end class << self; alias_method :without_deleted, :paranoia_scope end unless options[:without_default_scope] default_scope { paranoia_scope } end before_restore { self.class.notify_observers(:before_restore, self) if self.class.respond_to?(:notify_observers) } after_restore { self.class.notify_observers(:after_restore, self) if self.class.respond_to?(:notify_observers) } end
paranoia_scope()
click to toggle source
# File lib/paranoia.rb, line 251 def self.paranoia_scope where(paranoia_column => paranoia_sentinel_value) end
Also aliased as: without_deleted
paranoid?()
click to toggle source
# File lib/paranoia.rb, line 279 def self.paranoid? ; false ; end
Public Instance Methods
paranoid?()
click to toggle source
# File lib/paranoia.rb, line 280 def paranoid? ; self.class.paranoid? ; end
Private Instance Methods
paranoia_column()
click to toggle source
# File lib/paranoia.rb, line 284 def paranoia_column self.class.paranoia_column end
paranoia_sentinel_value()
click to toggle source
# File lib/paranoia.rb, line 288 def paranoia_sentinel_value self.class.paranoia_sentinel_value end