3
votes

Following the tutorial here

https://www.youtube.com/watch?v=THUG8J3xSYw&list=PLtTtLKRL6UYGxOHToRYnXBynon5plZ7Jd&index=1

trying to generate a model using scaffolding.

I tried this in the terminal

mix phx.gen.model Comment comments body:text post_id:references:posts

but I get the following in the terminal:

** (Mix) The task "phx.gen.model" could not be found. Did you mean "phx.gen.html"?

and I tried this in the terminal

mix phoenix.gen.model Comment comments body:text post_id:references:posts

but I get the following in the terminal:

** (Mix) The task "phoenix.gen.model" could not be found
1
This tutorial is pretty out of date, I recommend using a more recent resource. If you want to know more about why models have been replaced with contexts in 1.3, you can check this talk. - sabiwara

1 Answers

6
votes

in 1.3, model got deprecated. it is now schema

mix phx.gen.schema Comment comments body:text post_id:references:posts