What’s the suggested way to save one to many and many to many records?
Taking Post -> Categories as an example.
What’s the suggested way to save one to many and many to many records?
Taking Post -> Categories as an example.
i make it creating a new instance of the Categories model in your controller, then get a list of key=>categories and pass them to your view. use a dropdaown, multiselect etc, widget to select yout categories.
in the seccond part of your controller (the one witch tekes the post values, validates and saves) you have to make the necesary changes in order to save on both models.