In case someone comes across this question. This is what I ended up doing to get it to work. I have no idea if this would be considered the best solution or not, but it worked for me. Feel free to correct my code if I did something stupid.
def form_nodes(nodes, answers)
nodes.map do |node, sub_nodes|
render(:partial => 'folder/mypartial', :locals => { :node => node, :answers => answers, :f => builder}) + content_tag(:div, form_nodes(sub_nodes,answers), :class => "nested_nodes")
end.join.html_safe
end