-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
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
-
Database Migration:
- Create a new
commentstable with the following columns:id: Primary key.note_id: Foreign key referencing thenotestable.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_atandupdated_at: Timestamps.
- Create a new
-
Model:
- Create a
Commentmodel. - Add
belongs_to :noteassociation in theCommentmodel. - Add
has_many :commentsassociation in theNotemodel.
- Create a
-
Controller:
- Create a
CommentsControllerwith actions for:create: To add a new comment to a note.destroy: To delete a comment.
- Create a
-
Routes:
- Nest
commentsresources undernotesinconfig/routes.rb.
- Nest
-
Views:
- Update the
notesviews to display associated comments. - Add a form for creating new comments under each note.
- Update the
-
Tests:
- Add model tests for
Comment. - Add controller tests for
CommentsController. - Add feature tests for adding and viewing comments on notes.
- Add model tests for
Additional Notes
- Validation for
author_emailshould 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
Labels
No labels