url_for(:controller => :<name of model for controller_a>,:action => :<name of method for controller_a>)
Include your controller in another. Then create object of the class and call the method.
But In MVC structure this is bad practice to call another controller action.
Three option available to do the above functionality is
1:You should duplicate this action in your controller B
2: Or wrap it as a model method(Name it as some Manager), that will be shared to all controllers. (This is the convenient way to do coz later point if you need any common function you can add to the shared model (Manager) )
3: Or you can extend this action in controller A.
Thanks for your reply, but I don't agree with your statement that it is a bad practice to call another controller action.
For MVC I had so many years of experience, in some cases you have to deal with the hierarchical structure, which you need hierarchical controller structure to deal with this situation.
for example PAC pattern is like this:
It is a hierarchical MVC, which use controller to communicate with another controller, even if it is not hierarchical structure, but if we have multiple controller, the flow is always like
View A => controller A => controller B => view B
Back to my initial question, since I have hierarchical model structure, which is one to many, I need an hierarchical controller to render this type of data.
I hope Rhodes can provide a best practice for this kind of solution.
I really like to see the sample code to address this issue.
the solution it's the response that USER03959 already give you:
redirect :controller => :Controller_b, :action => :method_of_controller_b
but once you do watever you want on controller b you need to return to your controller 'a' doing it again:
redirect :controller => :Controller_a, :action => :method_of_controller_a