Question : How to implement a div box with sliding (autorefresh) content  from database with rails ?

I want to implement a div box on my homepage where the content is populated from a database items. The div content should (not the entire page) refresh every 5s (new random query) with a fading or sliding effect. How to do this with rails ? Thanks for your help.

Answer : How to implement a div box with sliding (autorefresh) content  from database with rails ?

This is a Rails question!  Put it in the Rails Zone!

Use this function: periodically_call_remote
http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M001629

So, you'd have your div, either populated with the first thing or whatever.
The page will include the periodically_call_remote function.

Point that function to a new method in your controller to do the database lookup.
Use the database information in an RJS template that does the page updates and sliding effects you want.

Make sense?  If you need more detail, tell me where you're stuck and I'll fill in some more info.
Random Solutions  
 
programming4us programming4us