File: //usr/local/rvm/gems/ruby-3.0.2/doc/actionview-6.1.4.1/ri/ActionView/Helpers/FormHelper/fields-i.ri
U:RDoc::AnyMethod[iI"fields:ETI"+ActionView::Helpers::FormHelper#fields;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AScopes input fields with either an explicit scope or model. ;TI"DLike +form_with+ does with <tt>:scope</tt> or <tt>:model</tt>, ;TI",except it doesn't output the form tags.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"5# Using a scope prefixes the input field names:
;TI"(<%= fields :comment do |fields| %>
;TI"& <%= fields.text_field :body %>
;TI"<% end %>
;TI"3# => <input type="text" name="comment[body]">
;TI"
;TI"@# Using a model infers the scope and assigns field values:
;TI"G<%= fields model: Comment.new(body: "full bodied") do |fields| %>
;TI"& <%= fields.text_field :body %>
;TI"<% end %>
;TI"G# => <input type="text" name="comment[body]" value="full bodied">
;TI"
;TI"(# Using +fields+ with +form_with+:
;TI"-<%= form_with model: @post do |form| %>
;TI"% <%= form.text_field :title %>
;TI"
;TI"/ <%= form.fields :comment do |fields| %>
;TI"( <%= fields.text_field :body %>
;TI" <% end %>
;TI"<% end %>
;T:@format0o;
; [I"LMuch like +form_with+ a FormBuilder instance associated with the scope ;TI"Ior model is yielded, so any generated field names are prefixed with ;TI"Leither the passed scope or the scope inferred from the <tt>:model</tt>.;T@S:RDoc::Markup::Heading:
leveli: textI"#Mixing with other form helpers;T@o;
; [I"JWhile +form_with+ uses a FormBuilder object it's possible to mix and ;TI":match the stand-alone FormHelper methods and methods ;TI"from FormTagHelper:;T@o;; [I"/<%= fields model: @comment do |fields| %>
;TI"& <%= fields.text_field :body %>
;TI"
;TI"/ <%= text_area :commenter, :biography %>
;TI"T <%= check_box_tag "comment[all_caps]", "1", @comment.commenter.hulk_mode? %>
;TI"<% end %>
;T;
0o;
; [I"LSame goes for the methods in FormOptionsHelper and DateHelper designed ;TI",to work with an object as a base, like ;TI"HFormOptionsHelper#collection_select and DateHelper#datetime_select.;T:
@fileI"+lib/action_view/helpers/form_helper.rb;T:0@omit_headings_from_table_of_contents_below000[ I"1(scope = nil, model: nil, **options, &block);T@@FI"FormHelper;TcRDoc::NormalModule00