Cast Common Boolean-Like Values To Booleans
Sometimes you have to deal with values that are supposed to represent booleans, but they aren't actually boolean values (i.e. "t"
instead of true
). Rail's ActiveModel
has a helper for casting these common boolean-like values to actual booleans.
This cast method gives you a handy way to handle all thsoe different cases. This is available as of Rails 5+.
Last updated