Displaying 1 result from an estimated 1 matches for "boolean_buttons_for".
2008 Dec 07
0
boolean button helper
...e making a mandatory choice. But doing this with radio buttons
typically takes 5 lines of html: 3 labels and 2 radio buttons.
Here''s a simple boolean button helper that you can put in your custom
form builder.
class YourCustomFormBuilder < ActionView::Helpers::FormBuilder
...
def boolean_buttons_for(method, label_true = "true", label_false =
"false" )
@template.content_tag("div",
@template.label(@object_name, method,
method.to_s.humanize, :class => ''align'' ) +
@template.radio_button( @object_name, method, true ) +
@templa...