
JimmyCarterSon
Seed Data with Elixir
Hello,
I am working on a new application with Elixir, Dish_out. I want to see Data I follow this tutorial with Elixir Casts. However, I am not sure if what I am doing is correct because my seed file does not work.
My Seed File:
alias DishOut.Recipes
Recipes.insert!(
%{title: "Mac N Cheese", ingredients: "Elbow Pasta, Milk, Cheese, Heavy cream", summary: "Bring pasta to a boil for 10 mins, drain water, add milk, cream, and cheese in. Stir and allow to cool before consuming.", date: "032022"}
)
In video the moderator alias another file, what is that file?
Marked As Solved

kokolegorille
There is no insert! function in the Food structure. And Foods should be the module used to create Food struct.
You cannot invent function name, it needs to exists in the file.
@doc """
Creates a food.
## Examples
iex> create_food(%{field: value})
{:ok, %Food{}}
iex> create_food(%{field: bad_value})
{:error, %Ecto.Changeset{}}
"""
def create_food(attrs \\ %{}) do
%Food{}
|> Food.changeset(attrs)
|> Repo.insert()
end
The closest is this one, and should be used like this…
DishOut.Foods.create_food(attrs)
3
Popular Backend topics

Real-time applications come with real challenges—persistent connections, multi-server deployment, and strict performance requirements are...
New

Don’t accept the compromise between fast and beautiful: you can have it all. Phoenix creator Chris McCord, Elixir creator José Valim, and...
New

New

It's easier to learn how to program a computer than it has ever been before. Now everyone can learn to write programs for themselves—no p...
New

A new PostgreSQL blog post/announcement has been posted!
Get the full details here: PostgreSQL: Generate realistic test Data for Postgr...
New

A new Rust blog post/announcement has been posted!
Get the full details here: Announcing Rust 1.53.0 | Rust Blog
New

Rust in Action introduces the Rust programming language by exploring numerous systems programming concepts and techniques. You'll be lear...
New

Phoenix 1.6.0 got released last week, with built-in authentication and mailer generators, a whole new HEEx (HTML-aware Embedded Elixir) e...
New

Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

Dear Geeks
I am new to pytest. I am following a youtube channel. I am writing the same code.
learning to test login functionality of an...
New
Other popular topics

Reading something? Working on something? Planning something? Changing jobs even!?
If you’re up for sharing, please let us know what you’...
New

What chair do you have while working… and why?
Is there a ‘best’ type of chair or working position for developers?
New

Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New

Do the test and post your score :nerd_face:
:keyboard:
If possible, please add info such as the keyboard you’re using, the layout (Qw...
New

Seems like a lot of people caught it - just wondered whether any of you did?
As far as I know I didn’t, but it wouldn’t surprise me if I...
New

We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New

Author Spotlight
Rebecca Skinner
@RebeccaSkinner
Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New

Author Spotlight:
Karl Stolley
@karlstolley
Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New

I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New

This is cool!
DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON
We just witnessed something incredible: the largest open-s...
New
Latest in Backend
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /react
- /clojure
- /quarkus
- /go
- /react-native
- /vapor
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /swift
- /deno
- /js
- /tailwind
- /laravel
- /assemblyscript
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /kubuntu
- /zig
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /emacs
- /nim
- /vuejs
- /elm
- /nerves