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/.
Vlad Khomich wrote:> > > 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 :Bad idea. Go with awesome_nested_set . I don''t know why people keep saying it''s poorly documented -- although the Github pages don''t say much, the rdoc is very clear. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Marnen Laibow-Koser wrote:> Vlad Khomich wrote: >> >> >> 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 : > > Bad idea. Go with awesome_nested_set . I don''t know why people keep > saying it''s poorly documented -- although the Github pages don''t say > much, the rdoc is very clear. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.orgi would really love to try it, but the rake documentation doesn`t say much to me.. i fear i`m too newb for it. -- Posted via http://www.ruby-forum.com/.
please, guys, can somebody just throw me some theory/suggestions. I have the comment models event.rb which has_many :comments and comment.rb which belongs_to :event and acts_as_nested_set (awasome one) how do i manage the comments? -- Posted via http://www.ruby-forum.com/.
Vlad Khomich wrote:> please, guys, can somebody just throw me some theory/suggestions. > > I have the comment models > event.rb which has_many :comments > > and comment.rb which belongs_to :event and acts_as_nested_set (awasome > one) > > how do i manage the comments?What are you asking here? About dealing with parent_id? You can pass that in the URL or similar. I''ll try to check how I did this last time I had to... Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.