Currently, it's not possible to set an article's published to false! Because of the way Rails handles presence validations, a false value indicates to Rails that the value is not present.
Solution
To fix this, I'll replace the presence: true validation with a inclusion: { in: [true, false]}, along with an error message. This will still prevent nil values from being permitted, as is indicated by an updated test.
Problem
Currently, it's not possible to set an article's
published
tofalse
! Because of the way Rails handlespresence
validations, afalse
value indicates to Rails that the value is not present.Solution
To fix this, I'll replace the
presence: true
validation with ainclusion: { in: [true, false]}
, along with an error message. This will still preventnil
values from being permitted, as is indicated by an updated test.This solution was provided by https://github.com/trailblazer/reform-rails/issues/47#issuecomment-293002004. Thank you.
This is a fix to https://github.com/allegroplanet/allegro-planet/pull/65