Is it somehow possible to call another controller's action from within a controller? redirect_to
is not what I need, because I've stored the request information (path, params, referer, xhr, ...) of another request and want to execute it now. Basically an exec
for controller actions would be wha开发者_如何转开发t I need. Simply instantiating the controller, setting the needed instance variables and calling the action is not enough, because this does not invoke the right filters and error handlers.
No. You can't do this. This is why with the MVC pattern you hear people recommend "skinny controllers".
Move the logic down into the models as much as possible. Then it's easy to share across controllers. Or you can try moving the similar actions into a shared controller so that they can share behaviour.
精彩评论