Vlad,
I think you may want to check out the :with option for the
link_to_remote. It will allow you to pass back to the controller the
comment.id for the link that was clicked. Is that what you mean?
--Tom
On Sep 23, 1:03 pm, Vlad Khomich
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi guys. I`m having this kind of problem:
>
> i have the comments tree, there`s this link_to_function under each one:
>
> link_to_function "Reply",
>
"$(''comment_parent_id'').setValue(#{comment.id});"
>
> as you see it simply passes comment.id to my form.
> Form looks like this :
>
> <div id="main-comment-form" >
> <%form_for :comment, :url => {:controller
=>''events'', :action
> =>''post_comment''} do |f| %>
> <%= f.hidden_field :parent_id, :value => nil %>
> <%= f.text_area :comment %><br>
> <%= f.submit "Add comment" %>
> <% end %>
> </div>
>
> i render both form and comments from partials.
>
> I need to somehow change this:
> link_to_function "Reply",
>
"$(''comment_parent_id'').setValue(#{comment.id});"
>
> to link_to_remote ( i want to open the form right under the comment
> after clicking the link) and keep the function to pass the comment.id
>
> any ideas/theory/suggestions are much appreciated! Thanks!
> --
> Posted viahttp://www.ruby-forum.com/.