title: Specific Database Structuring For Fitness Tracking
body: <p>I've been trying to wrap my head around how exactly this database should be modeled. I'm using Ruby on Rails to do a fitness tracking site. What I want is for users to be able to maintain a list of Exercises that they can then use to build and maintain their list of Routines. Then when they actually complete that routine it would make a Workout which would record the information for that one time they did the Routine. </p>
  
  <p>So, the Exercises and Routines are more like templates that a user can use so they don't have to re-enter all the information every time they do it. Where I'm getting confused is how to put this all together. A Routine can have a variable number of Exercises so I know I would need another table just to hold the association between them. My question is how would I be able to record the information each time in the Workout table? I hope this question is clear and below is my current idea for how to model this setup.</p>
  
  <p><strong>Exercise</strong><br>
  type:string (will be limited to "strength" or "cardio")<br>
  reps:int<br>
  weight:float<br>
  sets:int<br>
  distance:float<br>
  totalTime:time<br>
  <br>
  <br>
  <strong>Routine</strong><br>
  title:string<br>
  <br>
  <br>
  <strong>Workout</strong><br>
  dateTime:dateTime<br>
  ???</p>
  
  <p>I'm not sure how the recording of actual workout data can go. I can build the templates all day, but the rest eludes me. Any help is appreciated.</p>