Hi
I am a little confused - perhaps because of coming at this with a Java head but..
I am looking for the equivalent of a forward from Java MVC frameworks whereby the request and it's model data contents can be forwarded to another controller ?
Required scenario :
- NewsController posts to CommentsController to add a comment. - If the comment is valid we REDIRECT back to NewsContoller.show, all good. - If the comment is invalid we FORWARD back to NewsContoller.show. The comment (and error msgs) would still be in request scope so that view can render appropriate hints.
I currently get round this by using redirect_to (in place of a forward) and sticking the comment in the session. Then, in NewsController.show i check the session before loading the comment from the DB. I think this is kinda sucky but I found a DHH post that said there are no kinda forwards in rails :
How do peeps approach this scenario ?
Thanks
Matt