From 579b23cfb2c46aef79235798f3fb8e1ddf79817a Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 4 Oct 2019 08:47:48 -0300 Subject: [PATCH] Merge pull request #37353 from lxxxvi/correct-information-about-record-identification-for-form-helper correct information about record identification in form helper [ci skip] --- guides/source/form_helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index bee6755b52..404a69d422 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -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. -- GitLab