What happened to periodically_call_remote?

Hello there.
Im trying to update date by using the helper periodically_call_remote
but seems like it doesnt exist anymore on Rails 3.
So is there any other way i could do that?

On 14 January 2011 12:04, Filippos [email protected] wrote:

Hello there.
Im trying to update date by using the helper periodically_call_remote
but seems like it doesnt exist anymore on Rails 3.
So is there any other way i could do that?

Googling for
rails 3 periodically _call_remote
yields many hits and several alternative ways.

Colin

i tried it but i’ve run into other posts asking the same question.
Not any answer related to Rails 3 and Periodically_call_remote

Curious. I just tried Colin’s suggested Google search term, and got lots
of
likely-looking results; the top being a stackoverflow post about how to
do
it with jquery…


Top-posted from Android

On Jan 14, 2011 1:34 PM, “Filippos” [email protected] wrote:

i tried it but i’ve run into other posts asking the same question.
Not any answer related to Rails 3 and Periodically_call_remote

On Jan 14, 2:07 pm, Colin L. [email protected] wrote:

On 14 January 2011 12:04, Filippos [email protected] wrote: > > >
Hello there. > > Im trying…

On 14 January 2011 13:33, Filippos [email protected] wrote:

Please don’t top post, it makes it difficult to follow the thread.
Insert your reply at appropriate points in previous message. Thanks

i tried it but i’ve run into other posts asking the same question.
Not any answer related to Rails 3 and Periodically_call_remote

Colin

Filippos wrote in post #974933:

i tried it but i’ve run into other posts asking the same question.
Not any answer related to Rails 3 and Periodically_call_remote

I’d guess that periodically_call_remote was pulled because it’s directly
dependent on the Prototype JavaScript framework. It’s a thin wrapper
around Ajax.PeriodicalUpdater.

http://api.prototypejs.org/ajax/Ajax/PeriodicalUpdater/

In any case it’s relatively easy to implement that functionality. The JS
frameworks don’t even really make it all that much easier than straight
up JavaScript.

If you really want it back the helper has been extracted to:


def periodically_call_remote(options = {})
frequency = options[:frequency] || 10 # every ten seconds by
default
code = “new PeriodicalExecuter(function()
{#{remote_function(options)}}, #{frequency})”
javascript_tag(code)
end

As you can see here, all it really does is write out some JavaScript
that you could easily write yourself. To make matters worse, the helper
writes Obtrusive JavaScript. Rails 3 is has moved to Unobtrusive
JavaScript (UJS), which is probably another reason this was extracted.