Module: ActionView::Helpers::FormHelper
- Defined in:
- lib/optimism.rb
Instance Method Summary collapse
- #error_for(object_name, attribute, **options) ⇒ Object
- #error_id_for(object_name, attribute) ⇒ Object
Instance Method Details
#error_for(object_name, attribute, **options) ⇒ Object
102 103 104 |
# File 'lib/optimism.rb', line 102 def error_for(object_name, attribute, **) tag.span **.merge(id: error_id_for(object_name, attribute)) end |
#error_id_for(object_name, attribute) ⇒ Object
106 107 108 |
# File 'lib/optimism.rb', line 106 def error_id_for(object_name, attribute) Optimism.error_selector.sub("RESOURCE", object_name.to_s.delete("]").tr("[", "_")).sub("ATTRIBUTE", attribute.to_s)[1..-1] end |