[Rails] Re: how to make an ajax call to redirect

2010-10-29 Thread Jerome Fillioux
Glen's solution works perfect ! Thank you very much, your tip is a must have of every rails project, IMHO :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to

[Rails] Re: how to make an ajax call to redirect

2010-09-30 Thread Glen
Here is a cleaner way. Just put the following code on your application_controller.rb. Now, redirect_to should work with Ajax calls as well as regular requests. def redirect_to(options = {}, response_status = {}) if request.xhr? render(:update) {|page| page.redirect_to(options)} else s

[Rails] Re: how to make an ajax call to redirect

2010-09-24 Thread Sjoerd Andringa
Vicer Ontero wrote: >> And make sure you're *not* using the :update option on your remote_form. >> 'page.redirect_to()' will generate javascript similar to Hassan's >> aforementioned suggestion. > > Hi, just a note that this does not work. Because the redirect gets > trapped inside the Ajax cal

[Rails] Re: how to make an ajax call to redirect

2010-09-23 Thread Vicer Ontero
Sjoerd Andringa wrote: > Hi daociyiyou , > > Try this: > > def find_created_actions > unless @if_login >flash[:login]="..." >redirect_to(:controller=>"login",:action=>"login") > end > if @if_login >@user_cactio...@user.sponsored_actions >render :update

[Rails] Re: how to make an ajax call to redirect

2008-10-18 Thread Sjoerd Andringa
Hi daociyiyou , Try this: def find_created_actions unless @if_login flash[:login]="..." redirect_to(:controller=>"login",:action=>"login") end if @if_login @[EMAIL PROTECTED] render :update do |page| page.replace_html 'element_id', :p

[Rails] Re: how to make an ajax call to redirect

2008-10-18 Thread Hassan Schroeder
On Thu, Oct 16, 2008 at 1:24 AM, daociyiyou <[EMAIL PROTECTED]> wrote: > > I have an ajax call method like following: > ## > def find_created_actions >unless @if_login > flash[:login]="请登录或注册" > redirect_to(:controller=>"login",:action=>"login") >end >