• R
    Type cast falsy boolean symbols on boolean attribute as false · 2d12f800
    Ryuta Kamizono 提交于
    Before 34cc301f, type casting by boolean attribute when querying is a
    no-op, so finding by truthy boolean string (i.e.
    `where(value: "true") # => value = 'true'`) didn't work as expected
    (matches it to FALSE in MySQL #32624). By type casting is ensured, a
    value on boolean attribute is always serialized to TRUE or FALSE.
    
    In PostgreSQL, `where(value: :false) # => value = 'false'` was a valid
    SQL, so 34cc301f is a regresson for PostgreSQL since all symbol values
    are serialized as TRUE.
    
    I'd say using `:false` is mostly a developer's mistake (user's input
    basically comes as a string), but `:false` on boolean attribute is
    serialized as TRUE is not a desirable behavior for anybody.
    
    This allows falsy boolean symbols as false, i.e.
    `klass.create(value: :false).value? # => false` and
    `where(value: :false) # => value = FALSE`.
    
    Fixes #35676.
    2d12f800
可在Tags中查看这些版本中当前仓库的状态.
CHANGELOG.md 4.3 KB