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

Look at periodically_call_remote.

http://api.rubyonrails.org

-Bill

On Dec 3, 2007 6:51 PM, Henry Collingridge
[email protected] 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 D.
http://destiney.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs