title: Workout Plan model with Days and Exercises using Rails
body: <p>I would like to be able to create Workout Plan for the gym using Ruby on Rails. A Workout Plan would consist of a name, he would have X number of days which would have X number of exercises.</p>
  
  <p>This is what a Workout Plan would look like</p>
  
  <p>Name: <strong>Beginner Workout</strong></p>
  
  <p><ul>
      <li>Day 1</li>
      <ul>
          <li>Exercise 1</li>
          <li>Exercise 2</li>
          <li>Exercise 3</li>
      </ul>
      <li>Day 2</li>
      <ul>
          <li>Exercise 1</li>
          <li>Exercise 2</li>
      </ul>
      <li>Day 3</li>
      <ul>
          <li>Exercise 1</li>
          <li>Exercise 2</li>
          <li>Exercise 3</li>
          <li>Exercise 4</li>
      </ul>
      </ul></p>
  
  <p>Now the exercises would come from a given pool (entered by me), where the user can choose from (by Checkboxes).</p>
  
  <p>This is what a simplified form would look like to create a new Workout Plan:</p>
  
  <p><img src="https://i.stack.imgur.com/Enb02.png" alt="New Workout Plan Form"></p>
  
  <p>I am ok for now having a fixed amount of days and adding days dynamically would be my next step but for now it is not important.</p>
  
  <p>Right now i have 3 Models. Plan, PlanDay and Exercise. The relations are</p>
  
  <pre><code># == Schema Information
  #
  # Table name: plans
  #
  #  id         :integer          not null, primary key
  #  name       :string(255)
  #  created_at :datetime
  #  updated_at :datetime
  #
  
  class Plan &lt; ActiveRecord::Base
  
      has_and_belongs_to_many :plan_days
  
      accepts_nested_attributes_for :plan_days
  end
  
  # == Schema Information
  #
  # Table name: plan_days
  #
  #  id         :integer          not null, primary key
  #  name       :string(255)
  #  created_at :datetime
  #  updated_at :datetime
  #
  
  class PlanDay &lt; ActiveRecord::Base
  
      has_and_belongs_to_many :exercises
  
      accepts_nested_attributes_for :exercises
  end
  
  # == Schema Information
  #
  # Table name: exercises
  #
  #  id          :integer          not null, primary key
  #  name        :string(255)
  #  created_at  :datetime
  #  updated_at  :datetime
  #
  
  class Exercise &lt; ActiveRecord::Base
  
      has_and_belongs_to_many :plan_days
  end
  </code></pre>
  
  <p>I really can't get near a form like the above and i think my relations are maybe not right. I would appreciate any help, thanks.</p>