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

Blog: Seeding

exercises/deprecated_blog_seeding.livemd

Blog: Seeding

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 BookSearch: SeedingBook Search: Book Form

Blog: Seeding

You’re going to create a seed file for your existing Blog project. This seed file will make it easier to manually test your blog application.

Blog: Seeding

Use the priv/repo/seeds.exs file to seed your database with:

  1. A blog post without any comments.
  2. A blog post with an associated comment.

Once complete, use your seed file to seed the database.

$ mix ecto.reset

Then display comments on your Post show page.

Bonus: Faker

Add Faker as a dependency in your project.

Then use Faker to create a post with a large amount of text and a comment with a large amount of text.

Bonus: Create 100 Posts

Create a new seed file that will generate 100 posts.

Bonus: Create A Post With 100 Comments

Create a new seed file that will generate a post with 100 comments.

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: Seeding 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 BookSearch: SeedingBook Search: Book Form