ActionView::Helpers::FormTagHelper
def field_id(object_name, method_name, *suffixes, index: nil, namespace: nil)

Description

Returns an id value as a string, in the same format that text_field and other FormHelper helpers use.

Arguments

Changing a value updates the ERB and HTML.

The first part of the id. [ and ] become _ (a ][ pair becomes a single _, and a trailing ] is removed), as does any character other than letters, digits, -, . and : (such as punctuation or Japanese characters). For a model object, the model name is used.
Added after object_name, joined with _. A trailing ? is removed. Other characters are used as is (unlike object_name, punctuation is not replaced with _).
= nil
Appended to the id, joined with _. You can pass any number of them.
= nil
0
Added between object_name and method_name, joined with _. If object_name is empty, it is not added.
= nil
"admin"
Prepended to the id, joined with _.

ERB

Changes from the previous output: Added Removed Changed


          

HTML


          

Preview