Hi, I''m developing a Rails application that displays data from MySQL database table. I have an external python script that adds new rows to the table. My goal is to dynamically add new rows to the html table which is displayed in my browser (without reloading the page). I''ve read that Ajax can handle this task ("periodically_call_remote"). But I don''t want to periodically call a special method that checks if there is new row in the table and updates my html if needed, instead I want to update the page only when my python script adds a new entity. Any suggestions? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s not possible. Either the browser requests a new page or not. You can only force it to do so with something like "periodically_call_remote" --~--~---------~--~----~------------~-------~--~----~ 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 23 Jul 2008, at 13:40, ddtm wrote:> While looking for the solution, I''ve found "The Juggernaut > plugin" ("The Juggernaut plugin for Ruby on Rails aims to > revolutionize your Rails app by letting the server initiate a > connection and push data to the client."). The only bad thing is that > the plugin can''t interact with my python script.Juggernaut is a Flash based solution for pushing data. It''s still the client that instantiates the connection to the push server (which runs seperately). Flash allows connections to be kept open in a way similar to Comet and other persistent connection setups. You can then interact with the user''s page by sending it a chunk of javascript. That Javascript is received by the little Flash file and injected into the page. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> want to update the page only when my python script adds a new entity. > Any suggestions?If the reason for this is that you don''t want to query the database far more frequently than the data is updated, you can use page caching. Add a controller method that invalidates the cache; this can be invoked by your python script. Then a periodic page refresh will no longer hit the database until it has new rows. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Could you give me more detailed explanation (for a complete newbie)? Seems like the method you''ve suggested will solve my problem. On 23 июл, 18:01, Mark Thomas <r...-gkTqyYPWbQbz1n+OaKNE4w@public.gmane.org> wrote:> > want to update the page only when my python script adds a new entity. > > Any suggestions? > > If the reason for this is that you don''t want to query the database > far more frequently than the data is updated, you can use page > caching. Add a controller method that invalidates the cache; this can > be invoked by your python script. Then a periodic page refresh will no > longer hit the database until it has new rows.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 23, 4:31 pm, ddtm <dr.death...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Could you give a bit more detailed explanation of your solution (i''m > new to Rails and Ajax)?Caching is built-in so it is discussed in pretty much any Rails book. A good tutorial is here: http://www.railsenvy.com/2007/2/28/rails-caching-tutorial --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- scaffold not working like i hoped......
- Autocompleters and Sortables do not function in IE6
- Is there a Rails portlet like plugin/framework? (i.e. just basic to allow users to move windows around)
- How do I access the session in a rails plugin?
- Juggernaut Released - (a.k.a Armageddon)