Hooking up the context to our controller

If we go back to our controller (lib/vocial_web/controllers/poll_controller.ex), we'll see that our index function is currently only set up to display a single Poll, not multiple Polls! We need to figure this out first before we move on. The first thing we'll need to do is get rid of the garbage data that we originally created since we don't need placeholder data anymore! The next thing we’ll need to do is use polls as our variable name instead of poll since we're working with multiple sets of data. Finally, we'll need to change what we’re passing on to the views and templates from poll: poll to polls: polls.

It may seem like a little thing to do but it's important to make sure that our code is readable ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.