Skip to content

Readme lacks example code for integrating with forms #74

Description

@ahnbizcad

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!" )
  1. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions