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
Can I use fields_for for any models or do they have to be associated?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
6 matches
Mail list logo