Henry Collingridge
2007-Dec-04 00:51 UTC
Update a page from the database as changes happen
Hello all, Could someone point me towards a recipe for getting the content of a page to update based on changes in the database (versus updates to controls on the page, for example), please? Ideally I''d like fields on the page to change colour as activity occurs asynchronously in the database, so perhaps updates would happen in response to a timed event on the server side. Thanks in advance, Henry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Look at periodically_call_remote. http://api.rubyonrails.org -Bill Henry Collingridge wrote:> Hello all, > > Could someone point me towards a recipe for getting the content of a > page to update based on changes in the database (versus updates to > controls on the page, for example), please? > > Ideally I''d like fields on the page to change colour as activity > occurs asynchronously in the database, so perhaps updates would happen > in response to a timed event on the server side. > > Thanks in advance, > > Henry > > >--~--~---------~--~----~------------~-------~--~----~ 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 Dec 3, 2007 6:51 PM, Henry Collingridge <henry.collingridge-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ideally I''d like fields on the page to change colour as activity > occurs asynchronously in the database, so perhaps updates would happen > in response to a timed event on the server side.If you already know when stuff is to change without re-querying the db you can use simple javascript: var seconds = 100 document.content.fieldFoo.value = ''100'' function display() { document.content.fieldFoo.value = seconds if( seconds > 0 ) seconds -= 1 if( seconds <= 0 ) window.location.reload( true ); setTimeout( ''display()'', 1000 ) } display() -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---