Creating our Option schema
We'll need to create an Option schema, just like we have the Poll schema, but we'll need to do some additional legwork to make sure our representation makes sense. We'll also need to go back and fix up one thing we omitted from our Poll schema! First, we want to name our module Vocial.Votes.Option instead of Vocial.Votes.Poll (for obvious reasons). Next, we'll need to alias both Vocial.Votes.Poll and Vocial.Votes.Option. This is because we need the sanity helper for referencing the struct of our Option schema, and also because we'll need to reference the Poll schema as well to define our relationship to that table. We'll also need to create a :votes column on the schema; this one should be an integer with a default ...
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.
Read now
Unlock full access