accepts_nested_attributes_for explicitly checks for associations to exist
https://github.com/rails/rails/blob/f33d52c95217212cbacc8d5e44b5a8e3cdc6f5b3/activerecord/lib/active_record/nested_attributes.rb#L340
fields_for does not require accepts_nested_attributes_for to be defined,
but it won't
Hello again Fugee,
Fields in forms in Rails do not necessarily have to correspond with model
attributes.
Generally, you might find the Rails edge guide on forms very helpful- as
well as the `form_with` API docs which are a bit more specific for some of
these questions.
On Monday, February 17, 2020 at 12:38:03 AM UTC-5, Walter Lee Davis wrote:
>
> You may use fields_for for any object that you have declared
> "accepts_nested_attributes_for" in your form's parent model. It obviously
> makes the most sense to do this with a related object.
>
> Walter
>
> > On
On Monday, February 17, 2020 at 12:38:03 AM UTC-5, Walter Lee Davis wrote:
>
> You may use fields_for for any object that you have declared
> "accepts_nested_attributes_for" in your form's parent model. It obviously
> makes the most sense to do this with a related object.
>
> Walter
>
> > On
You may use fields_for for any object that you have declared
"accepts_nested_attributes_for" in your form's parent model. It obviously makes
the most sense to do this with a related object.
Walter
> On Feb 16, 2020, at 10:41 PM, fugee ohu wrote:
>
> Can I use fields_for for any models or do
5 matches
Mail list logo