April 2018
Beginner to intermediate
406 pages
9h 33m
English
One thing we will frequently want to do is pass some data along our controller down to the templates that are doing the display work, especially if there is any sort of conditional display logic or anything like that. If we run h Phoenix.Controller.render in our IEx terminal, we’ll see a definition for the function that matches the following:
def render(conn, template, assigns)
Right now, we’re passing along conn and index.html (remember that anything using the pipeline operator |> passes the result as the first argument into the next function), so let's also pass along some assigns. Specifically, we'll pass along a dummy data structure for our first poll. Open up poll_controller.ex and let's change the index ...