Sha256: cdc87508bfe954bc1fb8374c9f6e30dbce499e9b9503e6634b4d4991b3971b47

Contents?: true

Size: 302 Bytes

Versions: 10

Compression:

Stored size: 302 Bytes

Contents

module Trashable
  extend ActiveSupport::Concern

  included do
    default_scope -> { where(deleted: false) }
    scope :deleted, -> { where(deleted: true) }

    def soft_delete
      update_attribute(:deleted, true)
    end

    def recover
      update_attribute(:deleted, false)
    end
  end

end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
gaku-0.1.1 archive/app/models/concerns/trashable.rb
gaku_archive-0.1.1 app/models/concerns/trashable.rb
gaku-0.1.0 archive/app/models/concerns/trashable.rb
gaku_archive-0.1.0 app/models/concerns/trashable.rb
gaku_core-0.0.3 app/models/concerns/trashable.rb
gaku-0.0.3 core/app/models/concerns/trashable.rb
gaku-0.0.2 core/app/models/concerns/trashable.rb
gaku_core-0.0.2 app/models/concerns/trashable.rb
gaku-0.0.1 core/app/models/concerns/trashable.rb
gaku_core-0.0.1 app/models/concerns/trashable.rb