提交 579b23cf 编写于 作者: C Carlos Antonio da Silva

Merge pull request #37353 from...

Merge pull request #37353 from lxxxvi/correct-information-about-record-identification-for-form-helper

correct information about record identification in form helper [ci skip]
上级 b8418526
......@@ -317,7 +317,7 @@ form_with(model: @article, url: article_path(@article), method: "patch")
form_with(model: @article)
```
Notice how the short-style `form_with` invocation is conveniently the same, regardless of the record being new or existing. Record identification is smart enough to figure out if the record is new by asking `record.new_record?`. It also selects the correct path to submit to, and the name based on the class of the object.
Notice how the short-style `form_with` invocation is conveniently the same, regardless of the record being new or existing. Record identification is smart enough to figure out if the record is new by asking `record.persisted?`. It also selects the correct path to submit to, and the name based on the class of the object.
WARNING: When you're using STI (single-table inheritance) with your models, you can't rely on record identification on a subclass if only their parent class is declared a resource. You will have to specify `:url`, and `:scope` (the model name) explicitly.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册