Assigning a variable based on existence of other variables in ruby 1.9
<p>I got the job to fix a webistrano installation and now I am stuck in the situation where I have a receipt wherein the following assignment broke after the update from ruby 1.8 to ruby 1.9.3</p>

<pre><code>if defined? var_one != nil
  var_to_be_used = var_one
else
  $logger.info(var_one)
  var_to_be_used = var_two
end
</code></pre>

<p>I have made sure (by adding the above log-entries) that <code>var_one</code> and <code>var_two</code> hold the expected values.
For example when I expect <code>var_one</code> to hold the value I got following log:</p>

<blockquote>
  <p>** value in var_one<br>
  *** undefined local variable or method `var_two' for #&lt;Capistrano::Configuration::Namespaces::Namespace:0x000000032a6040&gt;</p>
</blockquote>

<p>The first case is never reached. The script always goes to the else case - even when <code>var_one</code> holds a string.</p>

<p>How can I fix it?</p>