title: If statement and/or breaking the server
body: <p>I have a after_create statement that uses the model to create nested attributes. I am filtering days of the week boolean fields but the if statement is freezing the server (no errors).</p>
  
  <p>I've included the relevant code below. For claification, sunday through saturday are boolean fields in the database. If I remove all of the "and" clauses that filter the boolean fields, the form completes, but I need to filter out dates that are not selected weekdays.</p>
  
  <pre><code>def new_visit  
    day = 0
    dates = (visit_date_start .. visit_date_end).count + 1
    while day &lt;= dates
      date = visit_date_start + day
      day_of_week = date.strftime("%A").downcase
      if (day_of_week == 'sunday' and sunday == true) or (day_of_week == 'monday' and monday == true) or (day_of_week == 'tuesday' and tuesday == true) or (day_of_week == 'wednesday' and wednesday == true) or (day_of_week == 'thursday' and thursday == true) or (day_of_week == 'friday' and friday == true) or (day_of_week == 'saturday' and saturday == true)
        visits.create(:visit_price =&gt; visit_price, :visit_type =&gt; visit_type, :client_id =&gt; client_id, :visit_date =&gt; date)
        day += 1
      end
    end
  end
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've looked into the logs and once in a while, the server throws an error like below. I belive this is a sqlite locking error. Is there any more insight on this?</p>
  
  <pre><code>BusyException: cannot rollback transaction - SQL statements in progress: rollback transaction
  </code></pre>