I'm making an model that I want to create in relationship to my user model. Following from http://www.phoenixframework.org/v0.13.1/docs/ecto-models#section-data-relationship-and-dependencies used the phoenix.gen.html as follows:
W:runcible>mix phoenix.gen.html Ansible ansibles ansible_name:string ansible_description:text user:belongs_to
But I Get the following when i run it.
Compiled web/models/user.ex
Compiled web/controllers/user_controller.ex
Generated runcible app
** (Mix) Unknown type `belongs_to` given to generator
Any ideas where I've made a mistake?
You are looking at an old version (0.13) of the documentation.
As of Phoenix 0.16 It should be:
mix phoenix.gen.model Video videos name:string approved_at:datetime description:text likes:integer views:integer user_id:references:users
Note:
user_id:references:users
instead of:
user:belongs_to
Here is a link to the latest docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With