How to create a live feed using Rails -


I am trying to create a live feed block that identifies the latest data added in the forum related discussion and automatically Updates a block on the second page from the latest post on that platform I am using Ruby on Rail and I would appreciate any help on this.

(If my question is not clear, I hope I can be more specific with one of these examples). I am trying to create some things like Rolling Twitter Advisory which are blog sites these days or will not mind like Twitter's home page, which automatically updates

"post-text" itemprop = "text">

This site was created by JavaScript automatically Vote on the server with XmlHttpRequests. This is possible by the setInterval function

The smallest version is something like this (jQuery but the library translation will be simple):

  set interval (function () ($ .getJSON ('/ posts.json', function (post) {// code to remove old post / code to insert new post});}, 5000);  < 

In the millisecond between

Then you can return the latest post to your post controller:

Greg Post Controller & lt; ApplicationController @posts = Post.find (: All ,: order = & gt; 'created_at desc') response_to do | format | Format.html format.json {render: jason = & gt; @post. To_json} and end

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -