When a controller responds to a link_to_remote with a redirect_to, the link_to_remote gets a success callback, this would seem like a bug to me, at a minimum it should return a failure? This is driving me crazy because all the login engines/generators respond to an authentication error with a redirect_to. The work around is to change them to all do a render :layout => false, :status => 500 if request.xhr? But that seems a little overkill. here is my simple test... clicking the first link returns a failure as expected, clicking the second link returns success... If this isn''t a bug can someone explain to me why :) -- thanks in my app/controllers/test_controller.rb.... def test unless request.get? id= params[:id] if id == "1" render :text => "login", :layout => false, :status => 500 else redirect_to :action => ''index'' end end end in my app/views/test/test.rhtml... <%= link_to_remote "test_good", :update => "test_div", :url => { :controller => ''test'' :action => ''test'', :id => 1}, :loading => "alert(''loading'')", :success => "alert(''success'')", :failure => "alert(''failed'')", :position => "after" %> <p> <%= link_to_remote "test_bad", :update => "test_div", :url => { :controller => ''test'', :action => ''test'', :id => 2 }, :loading => "alert(''loading'')", :success => "alert(''success'')", :failure => "alert(''failed'')", :position => "after" %> <h2> test </h2> <div id= "test_div" this is text in a div </div>
On Mar 27, 2006, at 9:46, Jim Morris wrote:> When a controller responds to a link_to_remote with a redirect_to, the > link_to_remote gets a success callback, this would seem like a bug to > me, at a minimum it should return a failure? > > This is driving me crazy because all the login engines/generators > respond to an authentication error with a redirect_to. The work around > is to change them to all do a > > render :layout => false, :status => 500 if request.xhr?Redirection in Ajax actions needs to use JavaScript, I have this in application.rb: # Ajax actions that find some problem need to do a redirect, but +redirect_to+ # does not work well because we are being called from JavaScript and is the # result of the redirection what will end up in the original view, the main # page is still there. To get a regular redirection we need to send back a # littel JavaScript. def javascript_redirect_to(options={}, *parameters_for_method_reference) url = url_for(options, *parameters_for_method_reference) render :text => %Q{<script type="javascript">window.location="# {url}"</script>} end If an action uses redirect_to then it is not ready out-of-the-box for Ajax usage, unless the redirection points to another Ajax action. -- fxn
Wow thanks that works incredibly well... With a minor mod I can plug this in everywhere I do a redirect_to... Thank you! def javascript_redirect_to(options={}, *parameters_for_method_reference) if request.xhr? url = url_for(options, *parameters_for_method_reference) render :text => %Q{<script type="javascript">window.location="#{url}"</script>} else redirect_to options end end Xavier Noria wrote:> On Mar 27, 2006, at 9:46, Jim Morris wrote: > >> When a controller responds to a link_to_remote with a redirect_to, the >> link_to_remote gets a success callback, this would seem like a bug to >> me, at a minimum it should return a failure? >> >> This is driving me crazy because all the login engines/generators >> respond to an authentication error with a redirect_to. The work around >> is to change them to all do a >> >> render :layout => false, :status => 500 if request.xhr? > > Redirection in Ajax actions needs to use JavaScript, I have this in > application.rb: > > # Ajax actions that find some problem need to do a redirect, but > +redirect_to+ > # does not work well because we are being called from JavaScript and > is the > # result of the redirection what will end up in the original view, > the main > # page is still there. To get a regular redirection we need to send > back a > # littel JavaScript. > def javascript_redirect_to(options={}, > *parameters_for_method_reference) > url = url_for(options, *parameters_for_method_reference) > render :text => %Q{<script > type="javascript">window.location="#{url}"</script>} > end > > If an action uses redirect_to then it is not ready out-of-the-box for > Ajax usage, unless the redirection points to another Ajax action. > > -- fxn > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Very good and simple indeed. Still, the questions about redirect_to is still open. Should it not result in failure as http code is 302? On 3/27/06, Jim Morris <morris@wolfman.com> wrote:> > Wow thanks that works incredibly well... With a minor mod I can plug > this in everywhere I do a redirect_to... Thank you! > > def javascript_redirect_to(options={}, *parameters_for_method_reference) > if request.xhr? > url = url_for(options, *parameters_for_method_reference) > render :text => %Q{<script type="javascript">window.location> "#{url}"</script>} > else > redirect_to options > end > end > > > > > Xavier Noria wrote: > > On Mar 27, 2006, at 9:46, Jim Morris wrote: > > > >> When a controller responds to a link_to_remote with a redirect_to, the > >> link_to_remote gets a success callback, this would seem like a bug to > >> me, at a minimum it should return a failure? > >> > >> This is driving me crazy because all the login engines/generators > >> respond to an authentication error with a redirect_to. The work around > >> is to change them to all do a > >> > >> render :layout => false, :status => 500 if request.xhr? > > > > Redirection in Ajax actions needs to use JavaScript, I have this in > > application.rb: > > > > # Ajax actions that find some problem need to do a redirect, but > > +redirect_to+ > > # does not work well because we are being called from JavaScript and > > is the > > # result of the redirection what will end up in the original view, > > the main > > # page is still there. To get a regular redirection we need to send > > back a > > # littel JavaScript. > > def javascript_redirect_to(options={}, > > *parameters_for_method_reference) > > url = url_for(options, *parameters_for_method_reference) > > render :text => %Q{<script > > type="javascript">window.location="#{url}"</script>} > > end > > > > If an action uses redirect_to then it is not ready out-of-the-box for > > Ajax usage, unless the redirection points to another Ajax action. > > > > -- fxn > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060327/d541406b/attachment.html
Emin Hasanov wrote:> Very good and simple indeed. > > Still, the questions about redirect_to is still open. Should it not > result > in failure as http code is 302?Aha! Thank you, this has been driving me nuts for the last few days, I was almost at the end of my tether. I have to agree with the original sentiment. I would expect the redirect to come back with a 302 and hence be caught by the :failure part of the redirect_to. Thanks for the answers to this question. Jeff -- Posted via http://www.ruby-forum.com/.
It does seem to be a bug to me, but without really understanding how the prototype library handles AJAX I can''t say for sure. But any unexpected response should return an error not success IMHO. Emin Hasanov wrote:> Very good and simple indeed. > > Still, the questions about redirect_to is still open. Should it not > result in failure as http code is 302? > > On 3/27/06, *Jim Morris * <morris@wolfman.com > <mailto:morris@wolfman.com>> wrote: > > Wow thanks that works incredibly well... With a minor mod I can plug > this in everywhere I do a redirect_to... Thank you! > > def javascript_redirect_to(options={}, > *parameters_for_method_reference) > if request.xhr? > url = url_for(options, *parameters_for_method_reference) > render :text => %Q{<script > type="javascript">window.location="#{url}"</script>} > else > redirect_to options > end > end > > > > > Xavier Noria wrote: > > On Mar 27, 2006, at 9:46, Jim Morris wrote: > > > >> When a controller responds to a link_to_remote with a > redirect_to, the > >> link_to_remote gets a success callback, this would seem like a > bug to > >> me, at a minimum it should return a failure? > >> > >> This is driving me crazy because all the login engines/generators > >> respond to an authentication error with a redirect_to. The work > around > >> is to change them to all do a > >> > >> render :layout => false, :status => 500 if request.xhr? > > > > Redirection in Ajax actions needs to use JavaScript, I have this in > > application.rb: > > > > # Ajax actions that find some problem need to do a redirect, but > > +redirect_to+ > > # does not work well because we are being called from > JavaScript and > > is the > > # result of the redirection what will end up in the original > view, > > the main > > # page is still there. To get a regular redirection we need to > send > > back a > > # littel JavaScript. > > def javascript_redirect_to(options={}, > > *parameters_for_method_reference) > > url = url_for(options, *parameters_for_method_reference) > > render :text => %Q{<script > > type="javascript">window.location="#{url}"</script>} > > end > > > > If an action uses redirect_to then it is not ready > out-of-the-box for > > Ajax usage, unless the redirection points to another Ajax action. > > > > -- fxn > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > > http://lists.rubyonrails.org/mailman/listinfo/rails > <http://lists.rubyonrails.org/mailman/listinfo/rails> > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Mar 27, 2006, at 22:43, Jim Morris wrote:> It does seem to be a bug to me, but without really understanding > how the > prototype library handles AJAX I can''t say for sure. But any > unexpected > response should return an error not success IMHO.Why do you consider a redirect to be an unexpected response? Why should a redirect be an error? -- fxn
You can also do the JavaScript redirect with RJS templates: render :update do {|page| page.redirect_to(:controller => ''my_controller'', :action => ''my_action'')} Basically does the same thing, but is less messy. On 3/27/06, Jim Morris <morris@wolfman.com> wrote:> Wow thanks that works incredibly well... With a minor mod I can plug > this in everywhere I do a redirect_to... Thank you! > > def javascript_redirect_to(options={}, *parameters_for_method_reference) > if request.xhr? > url = url_for(options, *parameters_for_method_reference) > render :text => %Q{<script type="javascript">window.location="#{url}"</script>} > else > redirect_to options > end > end > > > > > Xavier Noria wrote: > > On Mar 27, 2006, at 9:46, Jim Morris wrote: > > > >> When a controller responds to a link_to_remote with a redirect_to, the > >> link_to_remote gets a success callback, this would seem like a bug to > >> me, at a minimum it should return a failure? > >> > >> This is driving me crazy because all the login engines/generators > >> respond to an authentication error with a redirect_to. The work around > >> is to change them to all do a > >> > >> render :layout => false, :status => 500 if request.xhr? > > > > Redirection in Ajax actions needs to use JavaScript, I have this in > > application.rb: > > > > # Ajax actions that find some problem need to do a redirect, but > > +redirect_to+ > > # does not work well because we are being called from JavaScript and > > is the > > # result of the redirection what will end up in the original view, > > the main > > # page is still there. To get a regular redirection we need to send > > back a > > # littel JavaScript. > > def javascript_redirect_to(options={}, > > *parameters_for_method_reference) > > url = url_for(options, *parameters_for_method_reference) > > render :text => %Q{<script > > type="javascript">window.location="#{url}"</script>} > > end > > > > If an action uses redirect_to then it is not ready out-of-the-box for > > Ajax usage, unless the redirection points to another Ajax action. > > > > -- fxn > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cody Fauser http://www.codyfauser.com
Added an extra ''do'' on there ;) Should be: render :update {|page| page.redirect_to(:controller => ''my_controller'', :action => ''my_action'')} On 3/27/06, Cody Fauser <codyfauser@gmail.com> wrote:> You can also do the JavaScript redirect with RJS templates: > > render :update do {|page| page.redirect_to(:controller => > ''my_controller'', :action => ''my_action'')} > > Basically does the same thing, but is less messy. > > On 3/27/06, Jim Morris <morris@wolfman.com> wrote: > > Wow thanks that works incredibly well... With a minor mod I can plug > > this in everywhere I do a redirect_to... Thank you! > > > > def javascript_redirect_to(options={}, *parameters_for_method_reference) > > if request.xhr? > > url = url_for(options, *parameters_for_method_reference) > > render :text => %Q{<script type="javascript">window.location="#{url}"</script>} > > else > > redirect_to options > > end > > end > > > > > > > > > > Xavier Noria wrote: > > > On Mar 27, 2006, at 9:46, Jim Morris wrote: > > > > > >> When a controller responds to a link_to_remote with a redirect_to, the > > >> link_to_remote gets a success callback, this would seem like a bug to > > >> me, at a minimum it should return a failure? > > >> > > >> This is driving me crazy because all the login engines/generators > > >> respond to an authentication error with a redirect_to. The work around > > >> is to change them to all do a > > >> > > >> render :layout => false, :status => 500 if request.xhr? > > > > > > Redirection in Ajax actions needs to use JavaScript, I have this in > > > application.rb: > > > > > > # Ajax actions that find some problem need to do a redirect, but > > > +redirect_to+ > > > # does not work well because we are being called from JavaScript and > > > is the > > > # result of the redirection what will end up in the original view, > > > the main > > > # page is still there. To get a regular redirection we need to send > > > back a > > > # littel JavaScript. > > > def javascript_redirect_to(options={}, > > > *parameters_for_method_reference) > > > url = url_for(options, *parameters_for_method_reference) > > > render :text => %Q{<script > > > type="javascript">window.location="#{url}"</script>} > > > end > > > > > > If an action uses redirect_to then it is not ready out-of-the-box for > > > Ajax usage, unless the redirection points to another Ajax action. > > > > > > -- fxn > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Cody Fauser > http://www.codyfauser.com >-- Cody Fauser http://www.codyfauser.com
Basically the ajax handler is passing the redirect through as a success, so the recipient goes ahead and thinks whatever it requested was returned successfully, however a redirect (or any other response code other than 2xx) would not be a success. I undertand it can''t do a redirect as it needs to do it via javascript, but is it correct for it to just pass the response through as success? and not flag the fact that it got a non-ajax response from an ajax request. Xavier Noria wrote:> On Mar 27, 2006, at 22:43, Jim Morris wrote: > >> It does seem to be a bug to me, but without really understanding how the >> prototype library handles AJAX I can''t say for sure. But any unexpected >> response should return an error not success IMHO. > > Why do you consider a redirect to be an unexpected response? Why > should a redirect be an error? > > -- fxn > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
I thought rjs was edge only but now I see you released a plugin, I can''t reach your site right now (its probably busy giving everyone the plugin ;), but I''ll check that out as soon as I can get onto your site. Then I''ll need to update the user engine to use them instead of straight redirects. thanks Cody Fauser wrote:> You can also do the JavaScript redirect with RJS templates: > > render :update do {|page| page.redirect_to(:controller => > ''my_controller'', :action => ''my_action'')} > > Basically does the same thing, but is less messy. > > On 3/27/06, Jim Morris <morris@wolfman.com> wrote: > >> Wow thanks that works incredibly well... With a minor mod I can plug >> this in everywhere I do a redirect_to... Thank you! >> >> def javascript_redirect_to(options={}, *parameters_for_method_reference) >> if request.xhr? >> url = url_for(options, *parameters_for_method_reference) >> render :text => %Q{<script type="javascript">window.location="#{url}"</script>} >> else >> redirect_to options >> end >> end >> >> >> >> >> Xavier Noria wrote: >> >>> On Mar 27, 2006, at 9:46, Jim Morris wrote: >>> >>> >>>> When a controller responds to a link_to_remote with a redirect_to, the >>>> link_to_remote gets a success callback, this would seem like a bug to >>>> me, at a minimum it should return a failure? >>>> >>>> This is driving me crazy because all the login engines/generators >>>> respond to an authentication error with a redirect_to. The work around >>>> is to change them to all do a >>>> >>>> render :layout => false, :status => 500 if request.xhr? >>>> >>> Redirection in Ajax actions needs to use JavaScript, I have this in >>> application.rb: >>> >>> # Ajax actions that find some problem need to do a redirect, but >>> +redirect_to+ >>> # does not work well because we are being called from JavaScript and >>> is the >>> # result of the redirection what will end up in the original view, >>> the main >>> # page is still there. To get a regular redirection we need to send >>> back a >>> # littel JavaScript. >>> def javascript_redirect_to(options={}, >>> *parameters_for_method_reference) >>> url = url_for(options, *parameters_for_method_reference) >>> render :text => %Q{<script >>> type="javascript">window.location="#{url}"</script>} >>> end >>> >>> If an action uses redirect_to then it is not ready out-of-the-box for >>> Ajax usage, unless the redirection points to another Ajax action. >>> >>> -- fxn >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails@lists.rubyonrails.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> >>> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > > -- > Cody Fauser > http://www.codyfauser.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
Emin Hasanov wrote:> Very good and simple indeed. > > Still, the questions about redirect_to is still open. Should it not > result in failure as http code is 302?No. Just as your browser follows a redirect, rather than treating it as an error, an Ajax request can follow a redirect. regards Justin> > On 3/27/06, *Jim Morris * <morris@wolfman.com > <mailto:morris@wolfman.com>> wrote: > > Wow thanks that works incredibly well... With a minor mod I can plug > this in everywhere I do a redirect_to... Thank you! > > def javascript_redirect_to(options={}, > *parameters_for_method_reference) > if request.xhr? > url = url_for(options, *parameters_for_method_reference) > render :text => %Q{<script > type="javascript">window.location="#{url}"</script>} > else > redirect_to options > end > end > > > > > Xavier Noria wrote: > > On Mar 27, 2006, at 9:46, Jim Morris wrote: > > > >> When a controller responds to a link_to_remote with a > redirect_to, the > >> link_to_remote gets a success callback, this would seem like a > bug to > >> me, at a minimum it should return a failure? > >> > >> This is driving me crazy because all the login engines/generators > >> respond to an authentication error with a redirect_to. The work > around > >> is to change them to all do a > >> > >> render :layout => false, :status => 500 if request.xhr? > > > > Redirection in Ajax actions needs to use JavaScript, I have this in > > application.rb: > > > > # Ajax actions that find some problem need to do a redirect, but > > +redirect_to+ > > # does not work well because we are being called from > JavaScript and > > is the > > # result of the redirection what will end up in the original view, > > the main > > # page is still there. To get a regular redirection we need to send > > back a > > # littel JavaScript. > > def javascript_redirect_to(options={}, > > *parameters_for_method_reference) > > url = url_for(options, *parameters_for_method_reference) > > render :text => %Q{<script > > type="javascript">window.location="#{url}"</script>} > > end > > > > If an action uses redirect_to then it is not ready out-of-the-box for > > Ajax usage, unless the redirection points to another Ajax action. > > > > -- fxn
Ahh but that is exactly what is not happening, if you run my little test you will see that the ajax handler ignores the 302 response, does not redirect, and quietly triggers the success callback. If you do a render :status => 302 then it will catch the 302, but a redirect_to which supplies a standard http 302 is ignored. I understand why it doesn''t redirect now, but I don''t understand why it is treated as a success. If it can''t handle a standard redirect it should report it is an error at least. This causes all sorts of debugging problems when mixing the login engines with ajax calls. Justin Forder wrote:> Emin Hasanov wrote: >> Very good and simple indeed. >> >> Still, the questions about redirect_to is still open. Should it not >> result in failure as http code is 302? > > No. Just as your browser follows a redirect, rather than treating it > as an error, an Ajax request can follow a redirect. > > regards > > Justin > >> >> On 3/27/06, *Jim Morris * <morris@wolfman.com >> <mailto:morris@wolfman.com>> wrote: >> >> Wow thanks that works incredibly well... With a minor mod I can plug >> this in everywhere I do a redirect_to... Thank you! >> >> def javascript_redirect_to(options={}, >> *parameters_for_method_reference) >> if request.xhr? >> url = url_for(options, *parameters_for_method_reference) >> render :text => %Q{<script >> type="javascript">window.location="#{url}"</script>} >> else >> redirect_to options >> end >> end >> >> >> >> >> Xavier Noria wrote: >> > On Mar 27, 2006, at 9:46, Jim Morris wrote: >> > >> >> When a controller responds to a link_to_remote with a >> redirect_to, the >> >> link_to_remote gets a success callback, this would seem like a >> bug to >> >> me, at a minimum it should return a failure? >> >> >> >> This is driving me crazy because all the login >> engines/generators >> >> respond to an authentication error with a redirect_to. The work >> around >> >> is to change them to all do a >> >> >> >> render :layout => false, :status => 500 if request.xhr? >> > >> > Redirection in Ajax actions needs to use JavaScript, I have >> this in >> > application.rb: >> > >> > # Ajax actions that find some problem need to do a redirect, >> but >> > +redirect_to+ >> > # does not work well because we are being called from >> JavaScript and >> > is the >> > # result of the redirection what will end up in the original >> view, >> > the main >> > # page is still there. To get a regular redirection we need >> to send >> > back a >> > # littel JavaScript. >> > def javascript_redirect_to(options={}, >> > *parameters_for_method_reference) >> > url = url_for(options, *parameters_for_method_reference) >> > render :text => %Q{<script >> > type="javascript">window.location="#{url}"</script>} >> > end >> > >> > If an action uses redirect_to then it is not ready >> out-of-the-box for >> > Ajax usage, unless the redirection points to another Ajax action. >> > >> > -- fxn > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On 3/27/06, Jim Morris <morris@wolfman.com> wrote:> I thought rjs was edge only but now I see you released a plugin, I can''t > reach your site right now (its probably busy giving everyone the plugin > ;), but I''ll check that out as soon as I can get onto your site.My awesome textdrive server crashed again and the cron script that starts lighty on reboot somehow failed. I manually restarted it now, though. Also, with the release Rails 1.1 very soon the plugin won''t be necessary anymore.> > Then I''ll need to update the user engine to use them instead of straight > redirects. > > thanks > > Cody Fauser wrote: > > You can also do the JavaScript redirect with RJS templates: > > > > render :update do {|page| page.redirect_to(:controller => > > ''my_controller'', :action => ''my_action'')} > > > > Basically does the same thing, but is less messy. > > > > On 3/27/06, Jim Morris <morris@wolfman.com> wrote: > > > >> Wow thanks that works incredibly well... With a minor mod I can plug > >> this in everywhere I do a redirect_to... Thank you! > >> > >> def javascript_redirect_to(options={}, *parameters_for_method_reference) > >> if request.xhr? > >> url = url_for(options, *parameters_for_method_reference) > >> render :text => %Q{<script type="javascript">window.location="#{url}"</script>} > >> else > >> redirect_to options > >> end > >> end > >> > >> > >> > >> > >> Xavier Noria wrote: > >> > >>> On Mar 27, 2006, at 9:46, Jim Morris wrote: > >>> > >>> > >>>> When a controller responds to a link_to_remote with a redirect_to, the > >>>> link_to_remote gets a success callback, this would seem like a bug to > >>>> me, at a minimum it should return a failure? > >>>> > >>>> This is driving me crazy because all the login engines/generators > >>>> respond to an authentication error with a redirect_to. The work around > >>>> is to change them to all do a > >>>> > >>>> render :layout => false, :status => 500 if request.xhr? > >>>> > >>> Redirection in Ajax actions needs to use JavaScript, I have this in > >>> application.rb: > >>> > >>> # Ajax actions that find some problem need to do a redirect, but > >>> +redirect_to+ > >>> # does not work well because we are being called from JavaScript and > >>> is the > >>> # result of the redirection what will end up in the original view, > >>> the main > >>> # page is still there. To get a regular redirection we need to send > >>> back a > >>> # littel JavaScript. > >>> def javascript_redirect_to(options={}, > >>> *parameters_for_method_reference) > >>> url = url_for(options, *parameters_for_method_reference) > >>> render :text => %Q{<script > >>> type="javascript">window.location="#{url}"</script>} > >>> end > >>> > >>> If an action uses redirect_to then it is not ready out-of-the-box for > >>> Ajax usage, unless the redirection points to another Ajax action. > >>> > >>> -- fxn > >>> > >>> _______________________________________________ > >>> Rails mailing list > >>> Rails@lists.rubyonrails.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>> > >>> > >>> > >>> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > > > -- > > Cody Fauser > > http://www.codyfauser.com > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cody Fauser http://www.codyfauser.com