title: Passing virtual attribute values through to form elements in Rails 3
body: <p>I have the following in my model:</p>
  
  <pre><code>before_validation :update_temp
  
  attr_accessor :temp_int, :temp_dec
  
  def update_temp
  
      self.temp = temp_int.to_f + (temp_dec.to_f / 10)
  
  end
  </code></pre>
  
  <p>And I have the following in my view:</p>
  
  <pre><code>&lt;%= f.select(:temp_int, ["97", "98"], { :include_blank =&gt; true })%&gt; . 
  
  &lt;%= f.select(:temp_dec, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], { :include_blank =&gt; true })%&gt;
  </code></pre>
  
  <p>This works great for saving the temperature values. However, there's one issue. Normally on the edit screen, the select helper would have the existing values pre-selected. But using the virtual attributes this isn't happening.</p>
  
  <p>How do I make sure that the temp_int and temp_dec values get passed to the view?</p>