small medium large xlarge

25 May 2016, 18:34
André Michael Bonkowski (5 posts)

Hello again.

Starting with the source from the renders index.html test fails:

1) test renders index.html (Rumbl.VideoViewTest) test/views/video_view_test.exs:5 ** (ArgumentError) cannot convert map/struct to param, key :id contains a nil value stacktrace: (phoenix) lib/phoenix/param.ex:116: Phoenix.Param.Any.to_param/1 (rumbl) web/router.ex:1: Rumbl.Router.Helpers.video_path/4 (rumbl) web/templates/video/index.html.eex:23: anonymous fn/3 in Rumbl.VideoView.index.html/1 (elixir) lib/enum.ex:1473: Enum.”-reduce/3-lists^foldl/2-0-“/3 (rumbl) web/templates/video/index.html.eex:15: Rumbl.VideoView.”index.html”/1 (phoenix) lib/phoenix/view.ex:344: Phoenix.View.render_to_iodata/3 (phoenix) lib/phoenix/view.ex:351: Phoenix.View.render_to_string/3


Adding ids to the videos fixes this. Like this:

videos = [%Rumbl.Video{id: 1, title: "dogs"}, %Rumbl.Video{id: 2, title: "cats"}]
You must be logged in to comment