Sha256: 7f7f44c0724364d0263aae914cff37aa68e3f59d7640e46a18bcf24b88abe360

Contents?: true

Size: 582 Bytes

Versions: 13

Compression:

Stored size: 582 Bytes

Contents

require 'dm-types/paranoid/base'

module DataMapper
  class Property
    class ParanoidBoolean < Boolean
      default   false
      lazy      true

      # @api private
      def bind
        property_name = name.inspect

        model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          include DataMapper::Types::Paranoid::Base

          set_paranoid_property(#{property_name}) { true }

          default_scope(#{repository_name.inspect}).update(#{property_name} => false)
        RUBY
      end
    end # class ParanoidBoolean
  end # module Property
end # module DataMapper

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ardm-types-1.2.3 lib/dm-types/paranoid_boolean.rb
ardm-types-1.2.2 lib/dm-types/paranoid_boolean.rb
dm-types-1.2.2 lib/dm-types/paranoid_boolean.rb
dm-types-1.2.1 lib/dm-types/paranoid_boolean.rb
dm-types-1.2.0 lib/dm-types/paranoid_boolean.rb
dm-types-1.2.0.rc2 lib/dm-types/paranoid_boolean.rb
dm-types-1.2.0.rc1 lib/dm-types/paranoid_boolean.rb
dm-types-1.1.0 lib/dm-types/paranoid_boolean.rb
dm-types-1.1.0.rc3 lib/dm-types/paranoid_boolean.rb
dm-types-1.1.0.rc2 lib/dm-types/paranoid_boolean.rb
dm-types-1.1.0.rc1 lib/dm-types/paranoid_boolean.rb
dm-types-1.0.2 lib/dm-types/paranoid_boolean.rb
dm-types-1.0.1 lib/dm-types/paranoid_boolean.rb