Skip to content

Feature Request: Add Comments to Notes #27

@joel

Description

@joel

Feature Description

Add the ability to comment on notes. Each comment should include the following attributes:

  • content: The text of the comment.
  • author_name: The name of the author.
  • author_email: The email of the author.
  • created_at: Timestamp for when the comment was created.
  • updated_at: Timestamp for when the comment was last updated.

Implementation Details

  1. Database Migration:

    • Create a new comments table with the following columns:
      • id: Primary key.
      • note_id: Foreign key referencing the notes table.
      • content: Text field for the comment content.
      • author_name: String field for the author's name.
      • author_email: String field for the author's email.
      • created_at and updated_at: Timestamps.
  2. Model:

    • Create a Comment model.
    • Add belongs_to :note association in the Comment model.
    • Add has_many :comments association in the Note model.
  3. Controller:

    • Create a CommentsController with actions for:
      • create: To add a new comment to a note.
      • destroy: To delete a comment.
  4. Routes:

    • Nest comments resources under notes in config/routes.rb.
  5. Views:

    • Update the notes views to display associated comments.
    • Add a form for creating new comments under each note.
  6. Tests:

    • Add model tests for Comment.
    • Add controller tests for CommentsController.
    • Add feature tests for adding and viewing comments on notes.

Additional Notes

  • Validation for author_email should ensure it matches a valid email format.
  • Consider adding pagination for comments if a note has many comments.
  • Ensure proper error handling and user feedback for comment creation and deletion.

Priority

Medium

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