title: Rails Dividing Array and Assigning to Value
body: <p>In my Rails 4 app, I have submitted <code>Questions</code>.  What I want to do is to shuffle the order of the <code>Questions</code>, divide the list into seven (for the next seven days), and then save these <code>Questions</code> with a publish_date.  </p>
  
  <p>The <code>publish_dates</code> would be the next 7 days (i.e. <code>Date.current+1</code>, <code>Date.current+2</code>, <code>Date.current+3</code>, <code>Date.current+4</code>, <code>Date.current+5</code>, <code>Date.current+6</code>, <code>Date.current+7</code>).</p>
  
  <p>I understand that I can shuffle the records with <code>@questions.shuffle</code>, but I don't know how to divide the results by seven (I know that since the number of <code>Questions</code> won't always be divisible by 7, some days may end up with one additional <code>Question</code>), and how to assign those to a <code>publish_date</code>.</p>
  
  <p>Thank you in advance for any help!</p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>It sounds like I just need to use <code>in_groups_of</code> to divide the results.  What I don't understand now is how to assign the groups to the dates.</p>