Forum: Ruby on Rails Any way to implement delay() with ruby code?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af1ee2208795752559b049502ded660c?d=identicon&s=25 Andrew Cowan (k2mia)
on 2006-04-10 23:56
That is, is there any way to do something like an RJS page.delay()
except with
ruby code statements in the body instead of RJS statements?

If not, what kind of options would I have for wanting to execute a set
of statements n seconds in the future?

Thanks,
Andy
4c818e0c069b8efcb8604f5d5f7e923b?d=identicon&s=25 Simon C. Wex (Guest)
on 2006-04-11 07:17
(Received via mailing list)
What's the purpose of the delay? I doubt you'd want the delay to occur
in the processing of the rjs template as it would just delay the
response of the whole action. If you are wanting a delay in client-side
processing, I would suggest you look at the javascript setTimeout()
method. You could simply have the rjs template call a client-side method
   that issues a setTimeout.

The setInterval() js method might also help you out depending on what
you're doing.

Cheers, Simon.
0aa1ae25c39ad7935a78fef1013d26e5?d=identicon&s=25 Rob Halff (rhalff)
on 2006-04-11 09:29
(Received via mailing list)
You could, start a new thread and let it sleep for some seconds and then
execute, the code http://www.rubycentral.com/book/tut_threads.html
This topic is locked and can not be replied to.