Closed willrax closed 9 years ago
Add {:ecto, "~> 0.13.0"}
to your mix.exs deps and you should be good to go.
The reason being you are using a too recent ecto version that your phoenix version is not yet compatible.
Actually, ignore me, update to phoenix to: {:phoenix, "~> 0.14.0"}
instead of changing Ecto. It is better than using an old Ecto version.
Ah right. Thanks @josevalim.
@josevalim I'm still getting this error. I tried upgrading too.
Here's my mix.lock:
%{"cowboy": {:hex, :cowboy, "1.0.2"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"decimal": {:hex, :decimal, "1.1.0"},
"ecto": {:hex, :ecto, "0.14.1"},
"fs": {:hex, :fs, "0.9.2"},
"phoenix": {:hex, :phoenix, "0.14.0"},
"phoenix_ecto": {:hex, :phoenix_ecto, "0.6.0"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "0.4.3"},
"plug": {:hex, :plug, "0.13.0"},
"poison": {:hex, :poison, "1.4.0"},
"poolboy": {:hex, :poolboy, "1.5.1"},
"postgrex": {:hex, :postgrex, "0.9.1"},
"ranch": {:hex, :ranch, "1.1.0"}}
Quick update, I tried upgrading to more recent deps, but still same error. Here's the mix.lock file now:
%{"cowboy": {:hex, :cowboy, "1.0.2"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"decimal": {:hex, :decimal, "1.1.0"},
"ecto": {:hex, :ecto, "0.14.3"},
"fs": {:hex, :fs, "0.9.2"},
"phoenix": {:hex, :phoenix, "0.14.0"},
"phoenix_ecto": {:hex, :phoenix_ecto, "0.7.0"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "0.4.3"},
"plug": {:hex, :plug, "0.13.0"},
"poison": {:hex, :poison, "1.4.0"},
"poolboy": {:hex, :poolboy, "1.5.1"},
"postgrex": {:hex, :postgrex, "0.9.1"},
"ranch": {:hex, :ranch, "1.1.0"}}
Can you paste your errors? It should be just fine with the reported versions...
José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D
Sure, here goes:
1) test does not update chosen resource and renders errors when feed is invalid (FeedService.FeedControllerTest) test/controllers/feed_controller_test.exs:49 \ (Protocol.UndefinedError) protocol Phoenix.Param not implemented for {:ok, %FeedService.Feed{meta: %Ecto.Schema.Metadata{source: {nil, "feeds"}, state: :loaded}, filters: nil, id: "aa716042-f0f9-4437-83f6-0a85db9cd39e", inserted_at: #Ecto.DateTime2015-07-24T01:18:32Z, name: "foo", updated_at: #Ecto.DateTime2015-07-24T01:18:32Z, user_id: "123456"}} stacktrace: (phoenix) lib/phoenix/param.ex:122: Phoenix.Param.Any.to_param/1 (feed_service) web/router.ex:1: FeedService.Router.Helpers.feed_path/4 test/controllers/feed_controller_test.exs:51
When you upgraded Phoenix, did you run the generator again to update the generated code?
José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D
@fbjork as @josevalim mentioned, updating the dependencies and then rerunning the generator for my json resource fixed the issue.
Is there an easier way to re run a generator other than deleting the files and rerunning it? I was looking for an overwrite flag but couldn't spot one.
No, there is no such flag yet afaik.
Ok cool. Thanks for the help :)
Ah that did it. Adding a bang to Repo.insert! fixed the issues.
I got the same issue
\ (Protocol.UndefinedError) protocol Phoenix.Param not implemented for {:ok, %ElixirFriends.Post{meta: #Ecto.Schema.Metadata<:loaded>, content: "fobar", id: 35, image_url: "http://fc00.deviantart.net/fs71/i/2012/176/8/f/marvin_the_paranoid_android_by_wouthezx-d54uny0.jpg", inserted_at: #Ecto.DateTime2015-08-25T15:38:46Z, source_url: "http://elixirsips.com", updated_at: #Ecto.DateTime2015-08-25T15:38:46Z}}
I'm a totally phoenix newbee and blown away, following along on elixirsips 168: Continuous Integration.
I pulled a pristine version of phoenix. Here is my mix.lock file %{"cowboy": {:hex, :cowboy, "1.0.2"}, "cowlib": {:hex, :cowlib, "1.0.1"}, "decimal": {:hex, :decimal, "1.1.0"}, "ecto": {:hex, :ecto, "1.0.0"}, "fs": {:hex, :fs, "0.9.2"}, "phoenix": {:hex, :phoenix, "0.17.0"}, "phoenix_ecto": {:hex, :phoenix_ecto, "1.1.0"}, "phoenix_html": {:hex, :phoenix_html, "2.1.2"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.0.0"}, "plug": {:hex, :plug, "1.0.0"}, "poison": {:hex, :poison, "1.5.0"}, "poolboy": {:hex, :poolboy, "1.5.1"}, "postgrex": {:hex, :postgrex, "0.9.1"}, "ranch": {:hex, :ranch, "1.1.0"}}
Phoenix rocks, experienced ROR developer
@maxgronlund have you just generated the controller or it is an old one?
Just generated from a fresh download My report was inaccurate. $ "mix phoenix.server" runs like a charm and opening the page works perfect
$ mix test
/tests/views/post_controller_test.exs
test "shows an image for the post", %{conn: conn} do post = Repo.insert %Post{image_url: "http://fc00.deviantart.net/fs71/i/2012/176/8/f/marvin_the_paranoid_android_by_wouthezx-d54uny0.jpg", source_url: "http://elixirsips.com", content: "fobar"} conn = get conn, post_path(conn, :show, post) <<------- This line throw the error
end
I got it. my bad.. Knewter from Elixir Sips helped me with the following reply Insert now returns {:ok, model}. At the time of this episode it just returned model. Insert! just returns model. So you can either pattern match insert differently or replace it with insert!
Hi,
After starting a new project with phoenix and running
mix phoenix.gen.json Saying sayings name:string body:string
running
mix test
results in the following:Here are my deps.
The only thing i've changed is adding the pool to my test config file.
Any help is appreciated :)