mardi 20 septembre 2016

How to use an create two instance in just one for, using two controllers

I am new to Rails, and has been following several tutorials that lack the completeness of a real-time web-app. They show how to use a model-view-controller in each file, but I haven't found one that show how to create various models with just one form, using the methods of several controllers using association between them.

Use case:

I have a User model, an Account model that are associated. I tested it in irb, but in the controller, I need to have a User object to associate the user with the account, but when creating the user, it's just the form data for the user, managed by the user controller, as shown in the tutorials, and the accounts, separated in it's own view, managed by it's own controller.

how can I use the User created in the user controller, when creating an account. What I would like to do the most, it's create account when creating the user, in the same view. But what i really like it, it a tutorial that shows how to have Total Control over the views and controller, and how to accomodate those elements to your design. Thanks

Aucun commentaire:

Enregistrer un commentaire