Skip to content

Fancy booleans

Compare
Choose a tag to compare
@jasonfb jasonfb released this 02 Sep 16:34
· 121 commits to main since this release
b18076e

Given a table generated with this schema:

rails generate model Thing abc:boolean dfg:boolean hij:boolean 

• You can now use new flag --display-as to determine how the booleans will be displayed: checkbox, radio, or switch

rails generate hot_glue:scaffold Thing --include=abc,dfg,hij--god --display-as='abc{checkbox},dfg{radio},hij{switch}'

You may specify a default default_boolean_display in config/hot_glue.yml, like so:

:default_boolean_display: 'radio'

(The options are checkbox, radio, or switch.)
If none is given and no default is specified, legacy display behavior will be used (radio buttons)

Screenshot 2023-08-22 at 7 40 44 PM

You still use the --modify flag to determine the truthy and falsy labels, which are also used as the truth and false when a boolean is displays as radio button, as shown in the dfg field above. (switches and checkboxes simply display with the field label and do not use the truthy and falsy labels)

hot-gluev0 5 19- fancy booleans