title: Rails associations and forms
body: <p>I have a model called <code>appointment</code>. Each <code>appointment</code> has a <code>stylist</code>. In the form where I create a new <code>appointment</code>, I'm doing this:</p>
  
  <pre><code>  &lt;div class="field"&gt;
      &lt;%= f.label :stylist_id %&gt;&lt;br /&gt;
      &lt;%= f.select(:stylist_id, Stylist.order("name").map { |s| [s.name, s.id] }) %&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>This works but it's going to be tedious to do this kind of thing for every association in my app. I imagine Rails has some way of automatically generating select fields for associations but I have no idea how it works. Does such a thing exist?</p>
  
  <p>Oh, and by the way, I already know about scaffolding. If scaffolding is supposed to take care of what I describe above, I'm apparently doing something wrong, because it's not doing that for me.</p>
  
  <p>(I'm on Rails 3.)</p>