module

ActionView::Helpers::FormHelper

Inherits ActionView::Helpers::FormTagHelper < ActionView::Helpers::FormOptionsHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::TagHelper

Class methods

form_with_generates_ids
Source
form_with_generates_ids=(form_with_generates_ids)
Source
form_with_generates_remote_forms

Rails 8.1 defaults; apps on load_defaults 6.1+/8.x set these to false/true respectively (local forms, generated ids).

Source
form_with_generates_remote_forms=(form_with_generates_remote_forms)

Rails 8.1 defaults; apps on load_defaults 6.1+/8.x set these to false/true respectively (local forms, generated ids).

Source
polymorphic_path

Polymorphic model→path resolver (the Rails polymorphic_path analogue): installed by railties_cr at boot, pointing at CRails::Routes::UrlHelpers. action_view_cr cannot see the route set itself (the dependency runs the other way — action_pack_cr depends on action_view_cr). nil → form_with model: without url: raises ArgumentError.

Source
polymorphic_path=(polymorphic_path : Array(FormModel) -> String | Nil)

Polymorphic model→path resolver (the Rails polymorphic_path analogue): installed by railties_cr at boot, pointing at CRails::Routes::UrlHelpers. action_view_cr cannot see the route set itself (the dependency runs the other way — action_pack_cr depends on action_view_cr). nil → form_with model: without url: raises ArgumentError.

Source

Instance methods

fields(scope : String | Nil = nil, model : FormModel | Array(FormModel) | Nil = nil, url : String | Nil = nil, &) : String

fields — form_with's scoped builder WITHOUT the form tag (Rails 7.1+ fields; oracle fields_*). Unlike fields_for, ids follow the form_with config (form_with_generates_ids), and model: may be an array — the LAST model drives the scope. url: is accepted for signature parity and ignored (no form tag to attach it to).

Source
fields_for(scope : String | Symbol, model : FormModel | Nil = nil, &) : String

fields_for — view-level scoped fields without a form tag (oracle: ff_view* cases). Like form_with's builder, except ids ARE generated (Rails fields_for resets skip_default_ids).

Source
fields_for(model : FormModel, &) : String
Source
form_for(model : FormModel | Array(FormModel), url : String | Nil = nil, html : Hash | NamedTuple | Nil = nil, &) : String

form_for — the legacy form helper (oracle ffor_*): field ids ALWAYS generated, dom class (edit_/new_ + the LAST model's name) and dom id (edit_post_7 / new_post) on the form tag, local form (no data-remote). html: opts merge in before enctype/action — a user class REPLACES the dom class (Rails semantics). Attribute order: class, id, [html opts], enctype, action, accept-charset, method.

Source
form_with(url : String | Nil = nil, model : FormModel | Array(FormModel) | Nil = nil, scope : String | Nil = nil, **opts, &) : String

form_with url: "/x" do |f| ... end — capture-first: the block is rendered into a string before the open tag so file_field can flip the multipart flag. Attribute order per Rails: user opts, enctype, action, accept-charset, [data-remote], method (oracle fw_local / fw_file_multipart). Returns "" — the whole form goes to the output buffer in one piece.

Source
form_with(url : String | Nil = nil, model : FormModel | Array(FormModel) | Nil = nil, scope : String | Nil = nil, **opts) : SafeString

form_with without a block: opening tag + hidden fields only, NO (oracle fw_no_block) — the delete-form pattern.

Source

Nested types