Fancy booleans
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)
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)