Cant get the Ecto examples in programming phoenix to work

Hello,
I have been reading the book Programming Phoenix and it seems that somethings have changed since this book was written, particularly everything. I had to change some code (especially the nomenclature of different modules) in order to get things working. Up until now I have managed to do so, but now I cant.

I am stuck at the beginning of the chapter about Ecto. So I am supposed to create a user schema and generate a migration. the code in the book is:

defmodule Rumbl.User do
 use Rumbl.Web, :model 
 schema "users" do
    ....
 end
end

So with the new nomeclature it would be RumblWeb. When I try to create the migration mix tells me that there is no such ting as RumblWeb.model. He is unfortunately right :frowning: . In the book they show that web.ex should contain the model definition but it does not. Only : controller, view, router and channel are defined. What should I do?

thanks.
Eitan

1 Like

Use the same version of ecto and phoenix as in the book or wait for an updated release of the book covering more modern versions of the libraries.

But on a quick glance replacing use Rumb... with the following should be sufficient:

use Ecto.Schema
import Ecto.Changeset
1 Like

It worked! Thanks a lot.
What would you recommend:
Should I change and read the manual in the website or stick with the book and install an earlier version of Phoenix?

Thanks a lot!

1 Like