I have a partial on main page that displays current scores of game. The latest scores keep coming in database. I want to update that partial after every 5 seconds with values from db so that latest scores will be displayed. How can I do that? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you can handle that from you view: <%= periodically_call_remote(:url => mycontroller_path(), :method => :get, :frequency => 5) %> your controller must return the update as ajax in that case if you have some tag with id ''score_list'' it would look like @new_scores = ScoreList.find(...) render :update do |page| page.replace_html "score_list", :partial => "my_partial", :collection => @new_scores end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 15 Nov 2007, at 11:27, Vapor .. wrote:> > I have a partial on main page that displays current scores of game. > The > latest scores keep coming in database. I want to update that partial > after every 5 seconds with values from db so that latest scores will > be > displayed. How can I do that? > --You probably want to have a look at periodically_call_remote Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Muller wrote:> you can handle that from you view: > > <%= periodically_call_remote(:url => mycontroller_path(), :method => > :get, :frequency => 5) %> > > your controller must return the update as ajax in that case > if you have some tag with id ''score_list'' it would look like > > @new_scores = ScoreList.find(...) > render :update do |page| > page.replace_html "score_list", :partial => "my_partial", :collection > => @new_scores > endPerfect!!! Many thanks :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---