Sha256: ba3a26ccf3b40b918add1b14729ef17cc82216f72eb1496d13888b8c33651e08

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

# max_bits

  add_to_flags(
    ...
    max_bits: 63
  )

Sinn und Zweck von :max_bits. Beispiel ein bigint Feld von PostgreSQL hat
64 Bits. Das Bit 2**63 ist allerdings nur bei negativen Zahlen gesetzt.
Damit stehen für add_to_flags bei solch einem Feld nur 63 Bits also
höchstens das Bit 2**62 zur Verfügung. Die Option max_bits: 62 würde sichern,
dass kein höheres Bit verwendet wird. Falls doch würde bereits bei
add_to_flags eine Exception bereits beim Start der Rails-Web-App  geworfen und
nicht erst bei der Verwendung des Bits.

## Solution

Rails supports already "validate" which is, IMHO,
the right way to limit values to be stored in the database.
Furthermore, invalid values, stored by equivocation,
are detected by "validate".

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
act_with_flags-3.0.1 TODO