Add labels to radio buttons automatically

This commit is contained in:
Javi Martín
2019-10-03 20:43:13 +02:00
parent aec84f6522
commit 4f1131d2e5
6 changed files with 15 additions and 12 deletions

View File

@@ -27,6 +27,12 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
end
end
def radio_button(attribute, tag_value, options = {})
default_label = object.class.human_attribute_name("#{attribute}_#{tag_value}")
super(attribute, tag_value, { label: default_label }.merge(options))
end
private
def label_with_hint(attribute, options)