I got a task from my trainer. I want to edit two models in one form. For example, we have two entities student and address. In the new student part i want to add both student details and address. How can i achieve this through scaffolding in ruby on rails?
You can use accepts_nested_attributes_for and fields_for to build a form to create two model at same time, so you can edit them too. This kind of form called nested form
.
Here is a reference for you about Nested form,.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With