Portfolio: Blog Comments
Mix.install([
{:kino, github: "livebook-dev/kino", override: true},
{:kino_lab, "~> 0.1.0-dev", github: "jonatanklosko/kino_lab"},
{:vega_lite, "~> 0.1.4"},
{:kino_vega_lite, "~> 0.1.1"},
{:benchee, "~> 0.1"},
{:ecto, "~> 3.7"},
{:math, "~> 0.7.0"},
{:faker, "~> 0.17.0"},
{:utils, path: "#{__DIR__}/../utils"}
])
Navigation
Blog Comments
You’re going to add a the ability to comment on a blog to your existing portfolio project.
- Comments belong to a Blog.
- Blogs have many Comments.
Comments should have :user_id
, :content
, and :blog_id
fields.
classDiagram
class Comment {
blog_id: :id
content: :text
}
Comment Requirements
Ensure you:
- Can create an associated comment from the blog show page using a form with a textarea input.
- list all associated comments on the blog show page.
You do not need to handle commenting on a comment. All comments will be for the associated blog.
Bonus: Usernames
Add a new :username
field to each user if you have not already from a previous exercise.
Associate comments with the currently signed in user, and display the User’s :username
above each comment.
This creates a new relationship between Comments and Users, but does not change the relationship between Comments and Blogs.
- Users have many Comments.
- Comments belong to a User.
classDiagram
class User {
username: :text
}
class Comment {
user_id: :id
}
Ensure you:
- Display the username of the user associated with each comment on the blog show page, in the list of comments.
Commit Your Progress
Run the following in your command line from the project folder to track and save your progress in a Git commit.
$ git add .
$ git commit -m "finish portfolio comments exercise"