J
J
jFox2014-11-29 14:45:46
Ruby on Rails
jFox, 2014-11-29 14:45:46

Timers in Ruby/Rails, any ready-made solutions?

It is necessary to refresh the page after a certain period of time, which depends on the value in the database.
Are there ready-made timers (gems) that can handle this task?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2014-11-29
@miraage

controller

class MyController < ApplicationController
  def show
    @timer = 50; # for example
    render :show
  end
end

view
<meta http-equiv="Refresh" content="<%= @timer %>">

R
Renat Ibragimov, 2014-11-29
@MpaK999

Yes, the GON gem has a watch method to just pull the value at the right frequency - https://github.com/gazay/gon

B
Boris Penkovsky, 2014-11-29
@Able1991

And what is it for, if not a secret?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question