Replace_html and page.select behaviour

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?

Wrong copy/paste: the partial called is the same for all…

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 [email protected] 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:

Fred