From ce9143f25fa11d9ee850b3b193e69f3dd732ed85 Mon Sep 17 00:00:00 2001 From: Matthew Ford Date: Wed, 11 Mar 2009 00:08:22 +0800 Subject: [PATCH] update readme with nested redirect example Signed-off-by: James Golick --- README.rdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.rdoc b/README.rdoc index 6bdc677..cb7615e 100644 --- a/README.rdoc +++ b/README.rdoc @@ -72,6 +72,16 @@ Or you can create a whole new block. This syntax destroys everything that's the wants.js { render :template => "show.rjs" } end end + +If you have a nested resource and want to redirect to the parent after create/update and destroy you can do this in the object controller + + class CommentsController < ResourceController::Base + belongs_to :post + + create.wants.html { redirect_to smart_url(parent_url_options) } + update.wants.html { redirect_to smart_url(parent_url_options) } + destroy.wants.html { redirect_to smart_url(parent_url_options) } + end === Scoping