title: Passing in variables for preselection in a selection form (Ruby on rails)
body: <p>I'm going through the example in the AROR book:
   <a href="http://media.pragprog.com/titles/rails3/code/e1/views/app/views/test/select.rhtml" rel="nofollow">http://media.pragprog.com/titles/rails3/code/e1/views/app/views/test/select.rhtml</a></p>
  
  <pre><code>&lt;% @user = "cat"
  
  def @user.id
   4
   end
  
  &lt;% form_for :user do |form| %&gt;
    &lt;%= form.select(:name, %w{ Andy Bert Chas Dave Eric Fred }) %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>In this example, looks like @user.id is hardcoded to return 4.  I tried something like:</p>
  
  <pre><code>@temp = 4
  
  def @user.id
    @temp
  end
  </code></pre>
  
  <p>This didn't work...   How do I return a non global variable for this particular function?</p>