Multiple models for one controller

Hi All,

I want to know what the best to manage multiple models in one
controller is. I have a series of tables that simply manage
geogrophical ids, topic ids, type ids, etc… and I’d like to manage
them all from one controller.

What’s the best way to accomplish this?

Josh S. wrote:

Hi All,

I want to know what the best to manage multiple models in one
controller is. I have a series of tables that simply manage
geogrophical ids, topic ids, type ids, etc… and I’d like to manage
them all from one controller.

What’s the best way to accomplish this?

Controller’s don’t have to be bound to any specific model. Simply
create actions that manipulate other models. There is no constraint
that says one controller has to manipulate only one model.

Also, you may want to look into modularized controllers. This lets you
create groups of controllers. That may or may not be what you want.

Josh S. wrote:

Hi All,

I want to know what the best to manage multiple models in one
controller is. I have a series of tables that simply manage
geogrophical ids, topic ids, type ids, etc… and I’d like to manage
them all from one controller.

Why do you want to use only one controller? Is it because the code in
each controller is so similar and you want to stay DRY?

There are better ways than using just one controller. You could have a
controller hierarchy using OOP inheritance, you could use your own
scaffolding metaprogramming, or you could write a module and mix it
into your controllers.

Peter