Fix crash on attributes with interpolation arguments
The application crashed when we generated hints to attributes with interpolation arguments in their `human_attribute_name`. When generating the hint, we used the `custom_label` method to generate a label and get the `for` attribute and, since we weren't passing a text, it used the default human attribute name for the field. However, it crashes if the default attribute name requires an interpolation argument. So now, since we were only using the `custom_label` method in order to get the `for` attribute, we're simply passing an arbitrary text to the method.
This commit is contained in:
@@ -83,7 +83,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
|
||||
|
||||
def help_text_id(attribute, options)
|
||||
if options[:hint].present?
|
||||
"#{custom_label(attribute, nil, nil).match(/for="([^"]+)"/)[1]}-help-text"
|
||||
"#{custom_label(attribute, "Example", nil).match(/for="([^"]+)"/)[1]}-help-text"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user