title: Ruby Rails - how to update database with a calculation?
body: <p>I'm working on a simple rails app. The user enters two separate integers and when they press 'create', the 'show' page displays the two values and a third value which is calculated from the user input.  I have put the arithmetic to calculate the third value in the 'show' html.erb view, but I can't work out how to add the third value into the database. Heres my code for the 'show' view:`
      <p>
      <strong>Name:</strong>
      &lt;%= @startup.name %>
      </p></p>
  
  <pre><code>&lt;p&gt;
  &lt;strong&gt;Revenue:&lt;/strong&gt;
  &lt;%= @startup.revenue %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Costs:&lt;/strong&gt;
  &lt;%= @startup.costs %&gt;
  &lt;/p&gt;
  &lt;h2&gt;
  &lt;strong&gt;Profit:&lt;/strong&gt;
  &lt;%= @startup.profit = @startup.revenue - @startup.costs %&gt;
  </code></pre>