This gist was writen in 2012 and it was solving specific problem in Rails & SimpleForm. Some fellow developers were pointing out this may be out dated concept. That's why I advise everyone to read comment section bellow to have a full grasp of alternative solutions
other sources that may be helpful to understand why this may not be best idea:
@OpakAlex
and all are pointing to this gist as a single source ?
There is a good reason why this is not introduced in Ruby (or the notion of single boolean class which would TrueClass and FalseClass more info ) But this is not about Ruby it's about specifc usecase in Rails and SimpleForm. It was written in 2012 and it was solving an issue. I cannot tell if it's still valid as I didn't use Simple Form in 8 years but I see people having a conversation on this gist which I think is valuable.
I don't, but this gist is not about Ruby
I will not as I see value in the comment section. But I welcome if you drop here a comment guiding others how to better approach issue originally described or your thoughts on boolean in Ruby. I'm pretty sure everyone would welcome a constructive comment with a solution
have a lovely day