Hi everybody! Since there`s not much documentation for
awasome_nested_set , acts_as_commentable etc , i`m trying to build the
nested comments in easy way :

event.rb
..
has_many :comments
..

comment.rb
..
belongs_to :event
..

the following method saves the comment:

def post_comment
     @comment = Comment.new(
    "event_id" => flash[:event_id],     # yes, i store it in flash
   "created_at" => Time.now,
   "comment" => params[:comment]['comment'],
    "commenter" => current_user.login
     )
     if @comment.save
     ....

what i want to do is add "parent_id" column to comments table, add
"parent_id =>..." to post_comment. Then display a 'Reply' link under
each comment. The problem is i have no idea how to pass parent_id while
replying comment

the comments are displayed by the partial :
<ul>
  <div id="comment-list">
   <li><%=comment.commenter.capitalize%> says: <br><%= h comment.comment
%>
   <div style="color: #999; font-size: 8pt">
       Posted  <%= comment.created_at.strftime("%B %d, %Y at %I:%M %p")
%><br/>
     <%= link_to 'Reply', "something"%>
    </div>
   </li>
</div>
</ul>

I added some comments with parent_id manually to comments table, now i
need the way to change my partial to display all the child comment for
each parent comment.

i would really appreciate any suggestions/ideas . Thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to