Sha256: 8cbbfb77da171095ee59df7333cfb8c33175a725a2561d05d3b33029e2188198

Contents?: true

Size: 382 Bytes

Versions: 10

Compression:

Stored size: 382 Bytes

Contents

module Detour::Concerns
  module Keepable
    extend ActiveSupport::Concern

    included do
      attr_writer :to_keep
    end

    def to_keep
      @to_keep || (!marked_for_destruction? && !new_record?)
    end

    def keep_or_destroy(params = {})
      if params["to_keep"] == "1"
        self.to_keep = true
      else
        mark_for_destruction
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
detour-0.0.15 app/models/detour/concerns/keepable.rb
detour-0.0.14 app/models/detour/concerns/keepable.rb
detour-0.0.13 app/models/detour/concerns/keepable.rb
detour-0.0.12 app/models/detour/concerns/keepable.rb
detour-0.0.11 app/models/detour/concerns/keepable.rb
detour-0.0.10 app/models/detour/concerns/keepable.rb
detour-0.0.9 app/models/detour/concerns/keepable.rb
detour-0.0.7 app/models/detour/concerns/keepable.rb
detour-0.0.6 app/models/detour/concerns/keepable.rb
detour-0.0.5 app/models/detour/concerns/keepable.rb