3
Introduce `field_name` view helper by seanpdoyle · Pull Request #43409 · rails/r...
source link: https://github.com/rails/rails/pull/43409
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The field_name
helper and corresponding FormBuilder#field_name
method provide an Action View-compliant way of overriding a form field
element's [name]
attribute (similar to field_id
andFormBuilder#field_id
introduced in #40127[][]).
text_field_tag :post, :title, name: field_name(:post, :title, :subtitle) # => <input type="text" name="post[title][subtitle]"> text_field_tag :post, :tag, name: field_name(:post, :tag, multiple: true) # => <input type="text" name="post[tag][]"> form_for @post do |f| f.field_tag :tag, name: f.field_name(:tag, multiple: true) # => <input type="text" name="post[tag][]"> end
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK