Sha256: 10a32e7dacffd628ec8b628fe441f5c1e7f343abf9bdb15b97cb2cc5438f4f68
Contents?: true
Size: 508 Bytes
Versions: 31
Compression:
Stored size: 508 Bytes
Contents
module OhNoes module Destroy extend ActiveSupport::Concern included do default_scope where(:deleted_at => nil) end # options: # :with_prejudice => true, will not check destroyable? delegate :destroy!, :to => :destroy def destroy(options = {}) return false unless destroyable? || !!options[:with_prejudice] run_callbacks :destroy do update_column(:deleted_at, Time.now) end end def destroyable? true end end end
Version data entries
31 entries across 31 versions & 1 rubygems