title: How do I round numbers up to a dynamic precision in Ruby On Rails?
body: <p>I want to round numbers up to their nearest order of magnitude. (I think I said this right)</p>
  
  <p>Here are some examples:</p>
  
  <pre><code>Input =&gt; Output
  
  8 =&gt; 10
  34 =&gt; 40
  99 =&gt; 100
  120 =&gt; 200
  360 =&gt; 400
  990 =&gt; 1000
  1040 =&gt; 2000
  1620 =&gt; 2000
  5070 =&gt; 6000
  9000 =&gt; 10000
  </code></pre>
  
  <p>Anyone know a quick way to write that in Ruby or Rails?</p>
  
  <p>Essentially I need to know the order of magnitude of the number and how to round by that precision.</p>
  
  <p>Thanks!</p>