How to redirect_to the same page after comment posting?


#1

How can I have the page redirect_to the same page after someone posts a
comment?

I know that you can do “redirect_to :action => ‘index’”, but the page is
located at this URL:

/posts/2006/02/01/individual_post/

So, the action is “individual” which is in the “posts” controller, but
there is a custom URL mapped for the URL shown above. How can I reload
the page with the new comment?

Also, if anyone has some good Ajax tips, that would be great too!

Thanks!


#2

On Mar 4, 2006, at 5:33, ryan heath wrote:

So, the action is “individual” which is in the “posts” controller, but
there is a custom URL mapped for the URL shown above. How can I
reload
the page with the new comment?

Depending on the exact flow

 redirect_to :back

might be enough.

– fxn


#3

Any other ideas? I tried that one, didn’t work out. Thanks for the
input, though!


#4

redirect_to request.request_uri


#5

ryan heath a écrit :

Any other ideas? I tried that one, didn’t work out. Thanks for the
input, though!

rhtml:
<%= form_tag( { :controller => my_con , :action => “my_act” } %>

my_con_controller.rb:
def my_act
if request.get?
# first pass
else
# after post
end
end