Here is my problem :
I have a post controller with the action create. I would like that when a new post is created then I have as well an Activity that is created as well that will contain all informations about the post, …
For now i’m just creating and saving this activity inside the PostController create action but I would like to be able to launch the create action of the Activity Controller so that everything is the right place – but is it the way I should do that ? Is there a conceptual problem ?
Here is my problem : I have a post controller with the action create.
Share
Controllers are supposed to mediate the communication between views and models.
So, if you want to keep your code DRY, create (for example) a class method in
Activityclass that’ll do what you want and then call it from bothPostController#createandActivityController#create.This is far better than trying to fire a controller method (which would semantically mean another request from the client).