Skip to content Skip to sidebar Skip to footer

Problems Adding Fields In Nested Form Through Jquery Form Railscasts Episode

i have followed the railscasts episode on nested forms(part 1 and 2) and having difficulty with adding fields using jquery, however when i click the remove fields link, the field g

Solution 1:

I managed to figure this on out, but i am not sure if it is the best way. In application_helper.rb i changed the following line from this

link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")"))

to this

link_to_function(name, "add_fields(this, '#{association}', '#{escape_javascript(fields)}')", :remote => true)

i am not 100% sure why it works, but i believe its got to do with rails 3 no longer having the link_to_function. Hope this help

Post a Comment for "Problems Adding Fields In Nested Form Through Jquery Form Railscasts Episode"