title: Multiplying decimals and integers ruby on rails
body: <p>Seems pretty simple, but then nothing is. </p>
  
  <p>I have two values: </p>
  
  <pre><code>t.integer  "quantity"
  t.decimal  "unit_price",         :precision =&gt; 7, :scale =&gt; 2
  </code></pre>
  
  <p>I want to multiply quantity by unit_price in an each (invoice) loop:</p>
  
  <pre><code>invoice.quantity * invoice.unit_price
  </code></pre>
  
  <p>This causes the following error:</p>
  
  <pre><code>undefined method `*' for nil:NilClass
  </code></pre>
  
  <p>Do I have to convert the values first or is there something trivial I'm missing?</p>
  
  <p>Thanks</p>