Doug Pfeffer
2006-Jun-07 08:58 UTC
[Rails] using inline insert_html to generate uniquely named elements
Hello all, I?m using some inline rjs to add content with a unique id like so: In the <head>: function add_fields() { html = ''<div id="'' + new Date().getTime() + ''">''; html += "<%= escape_javascript(render :partial => ''field_set'') -%></div>"; new Insertion.After("whatever", html); } In the body: <%= link_to_function ''Add Fields'', update_page{|page| page.call ''add_fields'' } -%> And it works, but I wish there was a more concise way to do it all in the link_to(). Maybe by somehow including the getTime() wrapper bit around a page.insert_html? I haven?t been able to get anything like that to work, though. Any ideas? Thanks in advanced, Doug -- Posted via http://www.ruby-forum.com/.