Reputation: 8030
I have two models:
First one, User, contains the following attribute: email, password and boolean admin. The second one, Information, contains the folllowing attribute: name, surname, date_of_birth, address, city, country, post_code, phone, credit.
Abviously there is a relationship one-to-one, is it right to manage these two models with one controller, for instance, UsersController?
Upvotes: 0
Views: 62
Reputation: 3880
Controllers handle the user interaction. So the the structure of the controllers should be like it makes sense from the user perspective. Models handles the data and the business logic. But implementation details should not drive the user interface! So it makes it makes often sense to have one controller with two models, or a models with several controllers.
It is just that Rails makes it so easy to use one controller with exactly one corresponding model, and it works very often very well.
Upvotes: 1
Reputation: 5081
If these two models are bound by relation, accept_nested_attributes_for might be good solution.
Upvotes: 0