Complex form with ajax

does anyone know why;

= render_partial ‘comments/form’, :object => comment %>

works and

= link_to_function ‘Edit’, nil, :id =>
“edit_comment_#{}_link” do |page|

  • page.replace_html “comment_#{}”, :partial => ‘comments/
    form’, :object => comment

blows up basically because the object is not being fed correctly to
the partial, so i get a undefined method ticket for nil.

ps: its done in a loop (I.e: i create a link to edit one comment out
of many) therefore i cant say comment = @comment and let the partial
sort it.

here is the partial

=== #comments/form

  • form_for [form[:object].ticket, form[:object]] do |f|

    = error_messages_for :comment

    = f.text_area :body, :cols => 52, :rows => 10

    = f.submit

thanks in advance

“Wolas!” wrote:

= render_partial ‘comments/form’, :object => comment %>

Use render :partial => ‘comments/form’,
:locals => { :object => comment }

And :locals => is the answer to your other question too.

genious. thx

Another question:

Can i put a link_to_function inside a partial that is rendered by a
link_to_function? (basically an undo link)