Connecting polls to users

As mentioned previously, we did a lot of work when setting up user accounts in our system but nothing to actually connect, or even restrict access to, polls and user accounts. Thinking back to how we've set up other associations, there are a couple of steps that we have to implement before all of our polls are correctly linked to users. They are as follows:

  1. We need to link our tables by creating a migration that adds user_id to our polls table.
  2. We then need to modify the code in our schemas to represent the addition of the association.
  3. We need to modify all of the creation code in the context to set the poll's user_id to the appropriate user.
  4. Finally, we need to modify all of the delete and update code to only allow ...

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.