Does anyone here of this? Let me know what you guys think. Thanks.
Hello @shankardevy,
Are there any solutions to the exercises in the book Ecto Cookbook ?
Hello @all,
In the above mentioned book there is an exercise as follows,
Create a comments table with the following field
| Field name | Type |
|---|---|
| body | String |
| author_id | Foreign key references users |
| recipe_id | Foreign key references recipes |
In this table the foreign key references should follow the conditions below:
- an user cannot be deleted if there is at least one comment made by that user.
- when a recipe is deleted, all comments referencing to that recipe should also be deleted.ā
Excerpt From
Ecto Cookbook
Shankar Dhanasekaran
In the first condition it asks to make the migration in a way that if there is at least one comment the author canāt be deleted, but I think the on_delete: :nothing should be added to the :users, and for the second condition on_delete: :delete_all should be added to the :recipes table, because in both the cases records in the :comments table are child records.
Or is my mind mixed up right now and Iām missing something?
How do you feel about this today?
I really like the premise of the book, but it does not cover liveview.
Will someone please help me with this? I canāt go forward if this step is not clear.
Thank you!






















