Forum: Ruby on Rails Escaping the AJAX View

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.
Dylan S. (Guest)
on 2006-02-14 23:14
(Received via mailing list)
I have a login form, in which I use a "form_remote_tag".
I'm redirecting users to this form when they fail authentication as
well...
and using the "jumpto" method of capturing they
original URL they requested via request.parameters, and redirecting to
this
URL after they authenticate.

Problem is, if I try to do a "redirect_to", this won't work, as I'm
still in
the AJAX request.

I'm assuming my only alternatives are:
1)  Not use AJAX
2)  Send un-authenicated users to a different non-ajaxed login form.
3)  Parse the request.parameters, then pass the URL as a variable into a
template which then does a window.location redirect.

Any other ideas ?
Dylan S. (Guest)
on 2006-02-17 05:22
(Received via mailing list)
^bump^
Jonathan V. (Guest)
on 2006-02-17 10:24
You can use RJS to redirect the user. In the action you can do...

render :update do |page|
  page.redirect_to :action => :my_action
end

-Jonny.

Dylan S. wrote:
> ^bump^
Dylan S. (Guest)
on 2006-02-17 20:07
(Received via mailing list)
Genius, thanks Jonathan :)
My fear of RJS templates has been vanquished !  Edge demons be gone !!

It took me literally 10 minutes to switch out a complex form over to
RJS.
It works perfectly now.

Thank you, thank you, thank you :)
Jonathan V. (Guest)
on 2006-02-18 02:46
No problem. RJS is a very powerful tool.

-Jonny.

Dylan S. wrote:
> Thank you, thank you, thank you :)
This topic is locked and can not be replied to.