Forum: Ruby on Rails How to redirect_to the same page after comment posting?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e2dd87a31c5d3e07adc9efa375f4dc4?d=identicon&s=25 ry an (hreyaatnh)
on 2006-03-04 05:33
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!
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2006-03-04 07:10
(Received via mailing list)
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
1e2dd87a31c5d3e07adc9efa375f4dc4?d=identicon&s=25 ry an (hreyaatnh)
on 2006-03-04 07:44
Any other ideas?  I tried that one, didn't work out.  Thanks for the
input, though!
19403f509ca90e8ffe072214c6cba896?d=identicon&s=25 oo00oo (Guest)
on 2006-03-04 08:07
(Received via mailing list)
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
36958dd94ca666a38483df282a5214d5?d=identicon&s=25 Peter Ertl (Guest)
on 2006-03-04 09:20
(Received via mailing list)
redirect_to request.request_uri
This topic is locked and can not be replied to.