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.
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.
Exercise
type:string (will be limited to "strength" or "cardio")
reps:int
weight:float
sets:int
distance:float
totalTime:time
Routine
title:string
Workout
dateTime:dateTime
???
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.