Forum: Ruby on Rails RE: RJS replace_html auto-closing tags

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B29105598b6464efc13b04cb445efa85?d=identicon&s=25 Chris Bruce (Guest)
on 2006-04-20 01:50
(Received via mailing list)
Maybe you can try:

html = '<div>'
@projects.each do |p|
  html << 'results' << p.name << '<br />'
end
html << 'searchresults' << '</div>'

page.replace_html 'results', html


Something like that.


Chris
41e1579600683eed6c00af9a425268e6?d=identicon&s=25 Edward Frederick (Guest)
on 2006-04-20 01:59
(Received via mailing list)
I think both options are pretty awkward.

Put the stuff in a partial and do a replace with :partial render option.

--

Ed Frederick -- edwardfrederick.com
41e1579600683eed6c00af9a425268e6?d=identicon&s=25 Edward Frederick (Guest)
on 2006-04-20 01:59
(Received via mailing list)
Oh, and use replace, not replace_html.

The first div wasn't added for you, its just that it's 'still there'
because you're just replacing the innards.
This topic is locked and can not be replied to.