mercredi 1 juillet 2015

How to periodically called controller method in rails?

Possibly duplicated: How to get Rails to periodically call a controller method

I am on : http://localhost:3030/book/5 where I can see <%= @book.count %>

Now I want to write a jquery which periodically (every 5 seconds) call the show method in some interval of time.

 def show
  @book = Book.find(params[:id])
  # update the value of @post.count
  # save new value of count in post table for [:id]
  # return the updated value of count to http://localhost:3030/book/5
end

How can I implement it? Any help would be appreciable.

Aucun commentaire:

Enregistrer un commentaire