form_with
rails 5.1
, form_for
form_with
,
: url. URL, . , url_for link_to. , . a: scope : url, URL.
: . , , , "get", "post". "", "", "" , _method .
: . , . , : json. , : url.
: . , , .
: . : url : scope by, . , title "Ahoy!" "Ahoy!". , , . Pass: scope : url . . params [: post] params [: article].
: authenticity_token - . false, . , , . , config.action_view.embed_authenticity_token_in_remote_forms = false. . , , JavaScript.
: . XHR. : true.
: skip_enforcing_utf8. utf8 UTF-8. true, .
: builder - , .
: id - HTML-.
: class - HTML.
: . HTML.
: html. HTML .
<%= form_with(model: @post, url: super_posts_path) %>
<%= form_with(model: @post, scope: :article) %>
<%= form_with(model: @post, format: :json) %>
<%= form_with(model: @post, authenticity_token: false) %>
form_with
, admin_post_url:
<%= form_with(model: [ :admin, @post ]) do |form| %>
...
<% end %>
, , , , :
<%= form_with(model: [ @document, Comment.new ]) do |form| %>
...
<% end %>
doc