Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content