I have the following structure of data to be passed in HTML template
I wanted to display the movie name with all torrents info like URL, size etc. (right now only showing movie name, as I am learning the template system of phoenix)
defmodule WebmoviematchWeb.TorrentMoviesController do
use WebmoviematchWeb, :controller
def torrent_movies(conn, _params) do
torrent = %{"url" => "torrent-url", "size" => "1 GB", "quality" => "1080p"}
movies = %{"name" => "movie-name", "torrents" => [torrent]}
render(conn, "index.html", "torrent_movies": [movies])
end
end
and template code looks like
<!DOCTYPE html>
<html>
<body>
<% Enum.map(@torrent_movies, fn(item) -> %>
<%= Map.fetch!(item, "name") %>
<% end) %>
</body>
</html>
But the template is blank, even not showing the movie info.