Respond_to and redirect_to

Hi,

I have two controller actions like:

def foo
do_something
respond_to :html, :js
end

def bar
do_something_else
redirect_to :action => “foo”
end

How can I get foo to return JS, when bar is called via AJAX? What I’d
like to get is:

bar is called via AJAX
do_something_else is executed
do_something is executed
foo.rjs is rendered

The ideal solution should also work when foo and bar are in different
controllers.

Thanks for your help,

Timo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs