There isn’t something in Rails.
A better way than adding to the true/false classes to achieve something similar would be to make a method in ApplicationHelper:
def human_boolean(boolean)
boolean ? 'Yes' : 'No'
end
Then, in your view
<%= human_boolean(boolean_youre_checking) %>
Adding methods to built-in classes is generally frowned upon. Plus, this approach fits in closely to Rails’ helpers like raw()
.
Also, one offs aren’t a great idea as they aren’t easily maintained (or tested).