Periodically_call_remote renders Page in page

I am using Periodically_call_remote in the following way

<%= periodically_call_remote( :update => "refresh", :frequency => 3, :url => { :action => :activate }) %>

and the action i am calling is shown below. The activate action checks
for some value in a remote database and once the value says Active
then i want the user to be redirected to another page. But what is
happening is that the new page is getting loaded inside the Div
“refresh” tag. So its a page in page.

def activate
—perform something—
if ( Check = “active”)
redirect to different page

Any idea how i can do rectify this. Any other suggestions are welcome


First, I wouldn’t use the periodically_call inside the refresh div. I
have the feeling that it will vanish at the first call as it will be
replaced by the content if the update.
Anyway, if you want to redirect the user to another page, you cannot
use redirect because the periodical just replace some portion of the
page. So you have to use some JavaScript to tell the browser to change
the page location.
Put something like
JavaScript_tag window.location = new/location/whatever.
You may have to check some option to make sure this piece of code will
be evaluated.

Pardon my errors or typos, but Im on my mobile without access to
reference material.
You should find some info on periodacal on

Good luck

Le 8 avr. 2010 à 02:19, Ashwin V. [email protected] a écrit :