Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Blog: Tags

exercises/blog_tags.livemd

Blog: Tags

Mix.install([
  {:jason, "~> 1.4"},
  {:kino, "~> 0.9", override: true},
  {:youtube, github: "brooklinjazz/youtube"},
  {:hidden_cell, github: "brooklinjazz/hidden_cell"}
])

Navigation

Home Report An Issue Many-To-Many RelationshipsOne-to-One Relationships

Blog Tags

You’re going to add Tags to your existing Blog project.

Each blog post has a many-to-many association with tags.

Tags should have :name field describing the type of tag such as "tutorial", "elixir", "testing", etc.

Blogs and tags should be associated through a join table such as posts_tags.

erDiagram

Post {
}

Tag {
    string name
}

Post }O--O{ Tag: "posts_tags"

Tag Requirements

  • Migration and Schema:
    • Create a join table for tags and posts
    • Associate the Post and Tag schema through a many to many association
  • Functionality
    • Users can create tags (or seed a pre-existing set of tags).
    • Create, update, and delete posts with tags.
    • (bonus): Search and/or display posts by tag
    • (bonus): Allow a user to create tags when creating a post
  • Tests
    • Write context and controller tests to ensure a user can create, update, and delete a post with tags
    • All tests should pass. You may need to modify old tests and pages to ensure they continue to pass.
    • (bonus) Write test(s) to ensure a user can search for posts by tag.

Commit Your Progress

DockYard Academy now recommends you use the latest Release rather than forking or cloning our repository.

Run git status to ensure there are no undesirable changes. Then run the following in your command line from the curriculum folder to commit your progress.

$ git add .
$ git commit -m "finish Blog: Tags exercise"
$ git push

We’re proud to offer our open-source curriculum free of charge for anyone to learn from at their own pace.

We also offer a paid course where you can learn from an instructor alongside a cohort of your peers. We will accept applications for the June-August 2023 cohort soon.

Navigation

Home Report An Issue Many-To-Many RelationshipsOne-to-One Relationships