add dynamic nested attributes without nested form gem

Hello people

In my rails 3.0.9 app I'm trying to add nested attributes dynamically, but I don't want to use "nested form gem"

So I found this example

but this code doesn't work

module ProjectsHelper   def remove_link_unless_new_record(fields)     unless fields.object.new_record?       out = ''       out << fields.hidden_field(:_delete)       out << link_to_function("remove", "$ (this).up('.#{fields.object.class.name.underscore}').hide(); $ (this).previous().value = '1'")       out     end   end end

I think that lines which starts with "out <<" make some conflicts, because I've checked the html (firebug) and the simbols "<" and ">" doesn't appear

&lt;a href="#" onclick="$(this).up('.task').hide(); $ (this).previous().value = '1'; return false;"&gt;remove&lt;/a&gt;

Can you help me please?? Thanks