Ruby true, false, or nil
<p>I have an object with a boolean var.</p>

<pre><code> field :processing, :type =&gt; Boolean
</code></pre>

<p>The dev before me wrote some code that says this.</p>

<pre><code> :processing =&gt; nil 
</code></pre>

<p>(He is, for some reason, setting it to nil instead of false.)</p>

<p>He then does this if statement</p>

<pre><code> return if self.processing
 dosomethingelse....
</code></pre>

<p>If I write code that does this</p>

<pre><code>:processing =&gt; false 
</code></pre>

<p>what happens the next time this code runs? Does dosomethingelse run? </p>

<pre><code>return if self.processing
dosomethingelse....
</code></pre>

<p>UPDATE ===========</p>

<p>To many questions below so will answer here.</p>

<p>I added this </p>

<pre><code>  field :processing, :type =&gt; Boolean, :default =&gt; false
</code></pre>

<p>and it broke the app. When I changed to the above dosomethingelse never gets run?<br>
    <code>return if self.processing</code> returns. Any suggestions?</p>

<p>UPDATE 2 =======================================</p>

<p>Here is every reference to processing in my code (redacted). Also I am using MongoDB if that matters.</p>

<pre><code>.where(:processing =&gt; nil).gt(:retries =&gt; 0).asc(:send_time).all.entries


if self.processing 
end


return if self.processing
self.update_attributes(:processing =&gt; true)
dosomethingelse....


.where(:sent_time =&gt; nil).where(:processing =&gt; nil).gt(:retries =&gt; 0).asc(:send_time).all.entries

:processing =&gt; nil
</code></pre>