ActionView::Helpers::FormHelper
fields_for
API docs (Rails 8.1.4.1) ↗def fields_for(record_name, record_object = nil, options = {}, &block)
Description
Outputs only the content of the block, without creating a <form>. The fields in the block are bound to model attributes.
ERB
Changes from the previous output: Added Removed Changed
Controller action
@comment = Comment.new
Controller action
@comment = Comment.find(1)
HTML
Preview
Interacting with the preview updates the form submission.
Form submission
Form data
| name | value |
|---|
Request body
Content-Type:
params