def self.acts_as_paranoid(options={})
alias :really_destroyed? :destroyed?
alias :really_delete :delete
alias :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
default_scope { paranoia_scope }
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