title: What is the best way to add seven days recursively to a date in ruby on rails 5.2.3
body: <p>I currently a create multiple bookings endpoint, this takes weeks as &quot;qty&quot; as a param.</p>
  <p>So far I have this:</p>
  <p>In my controller action:</p>
  <pre><code>     def multiple
            @qty = params[:qty]
            @booking = Booking.new(booking_params)
            if @booking.save 
              @newbookings = @booking.createmore(@qty)
              render json: @newbookings, status: :created
            else 
              render json: @booking.errors, status: :unprocessable_entity
            end
        end
  
  </code></pre>
  <p>And in my model i have a routine to create multiple.</p>
  <pre><code>    def createmore(quantity)
          bookings = []
          quantity.to_i.times do 
              bookings.push(self)
          end 
          puts &quot;#{@bookings}&quot;
          newbookings = []
          firstBooking = self
  
          bookings.each do | booking |
              booking.start = firstBooking.start
              booking.end = firstBooking.end
              booking.name = firstBooking.name
              booking.email = firstBooking.email
              booking.contact = firstBooking.contact
              newbookings.push(booking)
          end
          newbookings.each do | booking |
              booking.save
          end
      end
  </code></pre>
  <p>The question is, how to add a week to the date recursively. i.e add 7 days to the second booking and 14 to the 3rd and 21 to the 4rth etc until qty is zero.</p>
  <p>I can do this in JavaScript with moment but have no clue where to even start in ruby. I would really appreciate any assistance.</p>