title: How to calculate total price of an order with Rails?
body: <p>I have the order list built up like so:</p>
  
  <p><strong>order.rb</strong></p>
  
  <pre><code>has_many :line_products
  </code></pre>
  
  <p><strong>LineProduct.rb</strong></p>
  
  <pre><code>belongs_to :order
  belongs_to :product
  </code></pre>
  
  <p>and has a value for <code>count</code> and a relationship for product (which is where it's getting the price from).</p>
  
  <p>So it goes like this:</p>
  
  <pre><code>product #1 has a price of $ 5.00
  product #2 has a price of $ 3.50
  
  line_product #1 has a count of 3 (so that's 3*5=15 USD)
  line_product #2 has a count of 6 (so that's 6*3.50=21 USD)
  </code></pre>
  
  <p>And I need, for the order show view, calculate the sum of <code>15 and 21</code>, how could I do that?</p>