Hi, I want to update a div element selected using its class. This is the code I tried in the RJS: page.replace_html page.select(''#account div.content'').first, :partial => ''my_html'' and also page.select(''#account div.content'').first.replace_html :partial => ''my_html'' Neither work whereas the following do work: page.select(''#account div.content'').each do |d| page.replace_html d, :partial => ''boxes/account'' end I miss something, can someone explain me? -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Wrong copy/paste: the partial called is the same for all... -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Page.select return a collection of object, thus you have to iterate over each element before using page.replace_html _Aurélien Bottazini_ http://www.mycashgarden.com
On Jun 18, 6:33 pm, Aurélien Bottazini <abottaz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Page.select return a collection of object, thus you have to iterate > over each element before using page.replace_html >To be slightly more precise page.select is a magic proxy object. I went into it in some detail here: http://www.spacevatican.org/2008/5/26/conditional-rjs-explained Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---