elight / acts_as_commentable_with_threading

Similar to acts_as_commentable; however, utilizes awesome_nested_set to provide threaded comments
MIT License
672 stars 167 forks source link

Readme lacks example code for integrating with forms #74

Open ahnbizcad opened 10 years ago

ahnbizcad commented 10 years ago

An example form would be immensely helpful. It would be a trivial matter for experts, but incredibly helpful and time-saving for newcomers. And for a good % of the time, a deciding factor for newcomers to use this gem instead of seeking other sources.

The current code for controllers, do they all go in the "Articles" controller? Which scope or file do they go into? This kind of information of often overlooked by experts, professors, and people who have been doing things for a long time because it' intimate knowledge to them, and often becomes a blind-spot in terms of teaching.

Some examples of ambiguity and confusion:

1) The following wording makes it seem like you need to write this code in the model. Easily un-confused by labeling the file name that this code should go in, (i.e. articles_controller.rb or should it be comments_controller.rb I still can't tell.)?

Add a comment to a model instance, for example an Article:

@article = Article.find(params[:id])
@user_who_commented = @current_user
@comment = Comment.build_from( @article, @user_who_commented.id, "Hey guys this is my comment!" )

2) where does this goo?

To make a newly created comment into a child/reply of another comment:

@comment.move_to_child_of(the_desired_parent_comment)

Other issues:

How to you properly use the "lft" and "rgt" integer columns?

The generator command doesn't produce a comments controller. Do we need a comments controller though? If not, how do you create comments? This is where an example form would help. Especially using it with ajax, which is most likely what everyone wants to do with it.

The model is under app/models/ for rails, not lib/

In lib/comment.rb uncomment the line acts_as_votable.
ahnbizcad commented 10 years ago

a good guide that covers a lot

http://twocentstudios.com/blog/2012/11/15/simple-ajax-comments-with-rails/

tezzataz commented 10 years ago

That guide is pretty useless with reference to this gem, it doesn't show how to enable threaded comments or how to reply to parent comments. Grateful for this gem but the read me and documentation is basic at best.

DustinFisher commented 8 years ago

I know this is an older issue, but I will throw this up here if someone else comes across this and looking for an example.

I worked through pieces and parts I found across the web and got threading working. I put a guide together showing how to get up and running.

Here is the example I put together: acts_as_commentable_with_threading example

RailsCod3rFuture commented 8 years ago

@DustinFisher did you add AJAX POST/Destroy?

RailsCod3rFuture commented 8 years ago

@DustinFisher Can you please add AJAX request to your tutorial, and then report back to the community? Thanks. Your example tutorial is great, btw.