I have 5 controllers and 5 views in my own project, I divided my app in these 5 main areas and I put many actions inside those areas/controllers.
I need many tables/models in my database, example: in the address content I need to separate some tables and build the correct relations to avoid duplicated fields… I want to manage address, user, person, legal entity, events, and many more.
What is the correct way to think in Rails at this point, if i create a model using scaffold:
rails generate scaffold city name:string state_id:integer
I get the correct model, the controller and views automatically.
I want to manage that City table in another controller, one of that five controllers that I created before, I need to manage many tables in just one view, or one controller.
If you know what I need to read and help me, I would appreciate.
model is independent of controller. you can use your any model in any controller. I think it’s one of the reason why MVC architecture is important.
based on the concept, you can manage your
citymodel, which is generated byscaffold, in any controller. just use ORM in your controller directly: