Sha256: c868b2cc282abaeb405e9004c0e512d635c18832e369f7b38b101ea4a2f6b90d

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

module ActiveRecord
  module OracleEnhanced
    module Type
      class Boolean < ActiveModel::Type::Boolean # :nodoc:
        # Add 'N' as FALSE_VALUES
        FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF', 'n', 'N'].to_set

        private

        def cast_value(value)
          # Not calling super to use its own `FALSE_VALUES`
          if value == ''
            nil
          else
            !FALSE_VALUES.include?(value)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-oracle_enhanced-adapter-1.7.11 lib/active_record/oracle_enhanced/type/boolean.rb
activerecord-oracle_enhanced-adapter-1.7.10 lib/active_record/oracle_enhanced/type/boolean.rb
activerecord-oracle_enhanced-adapter-1.7.9 lib/active_record/oracle_enhanced/type/boolean.rb
activerecord-oracle_enhanced-adapter-1.7.8 lib/active_record/oracle_enhanced/type/boolean.rb