Hi! I have been trying to use periodically_Call_remote in a table showing various devices , to update a row specific to a device. my view looks like: <html> <body> <p><strong>All Devices</strong><hr /></p> <table width="300" border="1"> <thead> <tr> <th width="130" scope="col">Device Name</th> <th width="100" scope="col">Ping Result</th> </tr> </thead> <tbody> <% @devices.each do |c|%> <tr> <td> <%=h c.name%> </td> <%= javascript_include_tag :defaults %> <%= periodically_call_remote(:update => "log_entry", :url => {:action => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> <td> <div id="log_entry"> </div> </td> </tr> <% end %> </tbody> </table> <%= will_paginate @devices %> </body> </html> and my controller action is : def get_ping_entry @dev=Dev.find(params[:id]) @status= Ipaddr.find(:first,:conditions=>["dev_id =?",@dev.id]).status render_text "status "+@status.to_s end its working fine but its updating only the first row i.e. its showing result of periodically call remote for every device in the first row only..not in the corresponding row for each device.. can you please help me with this?? thanking in advance --~--~---------~--~----~------------~-------~--~----~ 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 20 May 2008, at 07:53, sup wrote:> > Hi! > > <% @devices.each do |c|%> > <tr> > <td> > <%=h c.name%> > </td> > <%= javascript_include_tag :defaults %> > <%= periodically_call_remote(:update => "log_entry", :url => {:action > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > <td> > <div id="log_entry"> >Your div ids need to be unique. Fred -- My ramblings: http://www.spacevatican.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
yes i understood wats the problem.. the id''s need to be unique.. can you help me with that?? i t ried some methods but no help !! once again thanx alot for your prompt reply! On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 20 May 2008, at 07:53, sup wrote: > > > > > Hi! > > > > <% @devices.each do |c|%> > > <tr> > > <td> > > <%=h c.name%> > > </td> > > <%= javascript_include_tag :defaults %> > > <%= periodically_call_remote(:update => "log_entry", :url => {:action > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > <td> > > <div id="log_entry"> > > > Your div ids need to be unique. > > Fred > > > -- > My ramblings: http://www.spacevatican.org > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 20 May 2008, at 09:15, supriya agarwal wrote:> yes i understood wats the problem.. the id''s need to be unique.. can > you help me with that?? > i t ried some methods but no help !! > once again thanx alot for your prompt reply! >just generate a unique string "log_entry_#{c.id}" Fred> On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > > > On 20 May 2008, at 07:53, sup wrote: > > > > > Hi! > > > > <% @devices.each do |c|%> > > <tr> > > <td> > > <%=h c.name%> > > </td> > > <%= javascript_include_tag :defaults %> > > <%= periodically_call_remote(:update => "log_entry", :url => > {:action > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > <td> > > <div id="log_entry"> > > > Your div ids need to be unique. > > Fred > > > -- > My ramblings: http://www.spacevatican.org > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
i tried with this .. this isnt working , updating nothing on the page <%= javascript_include_tag :defaults %> <%= periodically_call_remote(:update =>"log_entry_#{c.id}", :url => {:action => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> <td> <div id="log_entry_<%#{c.id}%>" > </div> </td> On Tue, May 20, 2008 at 2:18 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 20 May 2008, at 09:15, supriya agarwal wrote: > > > yes i understood wats the problem.. the id''s need to be unique.. can > > you help me with that?? > > i t ried some methods but no help !! > > once again thanx alot for your prompt reply! > > > just generate a unique string "log_entry_#{c.id}" > > Fred > > On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung < > frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > wrote: > > > > > > On 20 May 2008, at 07:53, sup wrote: > > > > > > > > Hi! > > > > > > <% @devices.each do |c|%> > > > <tr> > > > <td> > > > <%=h c.name%> > > > </td> > > > <%= javascript_include_tag :defaults %> > > > <%= periodically_call_remote(:update => "log_entry", :url => > > {:action > > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > > <td> > > > <div id="log_entry"> > > > > > Your div ids need to be unique. > > > > Fred > > > > > > -- > > My ramblings: http://www.spacevatican.org > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 20 May 2008, at 09:59, supriya agarwal wrote:> i tried with this .. this isnt working , updating nothing on the page > > <%= javascript_include_tag :defaults %> > <%= periodically_call_remote(:update =>"log_entry_#{c.id}", :url => > {:action => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > <td> > <div id="log_entry_<%#{c.id}%>" > >Get your erb right: <%= c.id%> (you could tell this was the problem by looking at the html output) Fred> </div> > </td> > > > On Tue, May 20, 2008 at 2:18 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > > > On 20 May 2008, at 09:15, supriya agarwal wrote: > > > yes i understood wats the problem.. the id''s need to be unique.. can > > you help me with that?? > > i t ried some methods but no help !! > > once again thanx alot for your prompt reply! > > > just generate a unique string "log_entry_#{c.id}" > > Fred > > On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > wrote: > > > > > > On 20 May 2008, at 07:53, sup wrote: > > > > > > > > Hi! > > > > > > <% @devices.each do |c|%> > > > <tr> > > > <td> > > > <%=h c.name%> > > > </td> > > > <%= javascript_include_tag :defaults %> > > > <%= periodically_call_remote(:update => "log_entry", :url => > > {:action > > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > > <td> > > > <div id="log_entry"> > > > > > Your div ids need to be unique. > > > > Fred > > > > > > -- > > My ramblings: http://www.spacevatican.org > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey! Thanx alot! it worked fine :) Thanx boss..! On Tue, May 20, 2008 at 3:14 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 20 May 2008, at 09:59, supriya agarwal wrote: > > > i tried with this .. this isnt working , updating nothing on the page > > > > <%= javascript_include_tag :defaults %> > > <%= periodically_call_remote(:update =>"log_entry_#{c.id}", :url => > > {:action => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > <td> > > <div id="log_entry_<%#{c.id}%>" > > > > Get your erb right: <%= c.id%> (you could tell this was the problem by > looking at the html output) > > Fred > > </div> > > </td> > > > > > > On Tue, May 20, 2008 at 2:18 PM, Frederick Cheung < > frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > wrote: > > > > > > On 20 May 2008, at 09:15, supriya agarwal wrote: > > > > > yes i understood wats the problem.. the id''s need to be unique.. can > > > you help me with that?? > > > i t ried some methods but no help !! > > > once again thanx alot for your prompt reply! > > > > > just generate a unique string "log_entry_#{c.id}" > > > > Fred > > > On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung < > frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > wrote: > > > > > > > > > On 20 May 2008, at 07:53, sup wrote: > > > > > > > > > > > Hi! > > > > > > > > <% @devices.each do |c|%> > > > > <tr> > > > > <td> > > > > <%=h c.name%> > > > > </td> > > > > <%= javascript_include_tag :defaults %> > > > > <%= periodically_call_remote(:update => "log_entry", :url => > > > {:action > > > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > > > <td> > > > > <div id="log_entry"> > > > > > > > Your div ids need to be unique. > > > > > > Fred > > > > > > > > > -- > > > My ramblings: http://www.spacevatican.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you''re in Rails 2.x, use the dom_id method to create the id <div id="log_entry_<%= c.id %>"> ~ <div id="<%dom_id(device, :log_entry) %>"> Or, since you specifically want a div: <% div_for device do %> ... <% end %> On May 20, 6:33 am, "supriya agarwal" <supriya.ii...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey! > > Thanx alot! it worked fine :) > > Thanx boss..! > > On Tue, May 20, 2008 at 3:14 PM, Frederick Cheung < > > frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 20 May 2008, at 09:59, supriya agarwal wrote: > > > > i tried with this .. this isnt working , updating nothing on the page > > > > <%= javascript_include_tag :defaults %> > > > <%= periodically_call_remote(:update =>"log_entry_#{c.id}", :url => > > > {:action => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > > <td> > > > <div id="log_entry_<%#{c.id}%>" > > > > Get your erb right: <%= c.id%> (you could tell this was the problem by > > looking at the html output) > > > Fred > > > </div> > > > </td> > > > > On Tue, May 20, 2008 at 2:18 PM, Frederick Cheung < > > frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > wrote: > > > > On 20 May 2008, at 09:15, supriya agarwal wrote: > > > > > yes i understood wats the problem.. the id''s need to be unique.. can > > > > you help me with that?? > > > > i t ried some methods but no help !! > > > > once again thanx alot for your prompt reply! > > > > just generate a unique string "log_entry_#{c.id}" > > > > Fred > > > > On Tue, May 20, 2008 at 1:39 PM, Frederick Cheung < > > frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > wrote: > > > > > On 20 May 2008, at 07:53, sup wrote: > > > > > > Hi! > > > > > > <% @devices.each do |c|%> > > > > > <tr> > > > > > <td> > > > > > <%=h c.name%> > > > > > </td> > > > > > <%= javascript_include_tag :defaults %> > > > > > <%= periodically_call_remote(:update => "log_entry", :url => > > > > {:action > > > > > => ''get_ping_entry'', :id => c.id}, :frequency =>3) %> > > > > > <td> > > > > > <div id="log_entry"> > > > > > Your div ids need to be unique. > > > > > Fred > > > > > -- > > > > My ramblings:http://www.spacevatican.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---