CRUD when saving aggregate objects/calling one controller fr

My project has a number of objects that aggregate other objects. In
certain contexts, objects can either be a root object or a child to
another object.

For example:

Object A can be manipulated on it’s own and has it’s own controller.
Object B can be manipulated on it’s own and has it’s own controller.
Object C can be manipulated on it’s own and has it’s own controller.

Object A has many B instances. C can have many instances of B as well.

What is the best way to reuse the save/update code from controller B
when saving A with B as A’s children?

There are a number of business related actions required when saving B
that do not seem appropriate for the model

Thanks,
Dan

On 12/23/06, Dan [email protected] wrote:

There are a number of business related actions required when saving B
that do not seem appropriate for the model

How do you figure? The model is precisely where business-related
actions should go.

Pat

On 12/23/06, Dan [email protected] wrote:

they are saved. In otherwords lots of logic. I am pretty new to
Rails, but with other MVC platforms I have tried to put most of the
this type of functionality into controllers. Wrong application with
Rails?

Wrong approach with MVC. Business logic goes in the model. The
controller is just for coordinating stuff. Jamis B. has a good
article [1] that ought to shed some light for you.

Pat

[1] Buckblog: Skinny Controller, Fat Model

There are a number of business related actions required when
saving B

that do not seem appropriate for the modelHow do you figure? The model is precisely where business-related
actions should go.

Pat

I am creating user tasks, sending notifications, starting long-running
business processes, auditing, etc based on the state of the objects as
they are saved. In otherwords lots of logic. I am pretty new to
Rails, but with other MVC platforms I have tried to put most of the
this type of functionality into controllers. Wrong application with
Rails?

Thanks.

Thanks, the link was very helpful.l