I have a model called appointment. Everyone appointmenthas stylist. In the form where I create a new one appointment, I do this:
<div class="field">
<%= f.label :stylist_id %><br />
<%= f.select(:stylist_id, Stylist.order("name").map { |s| [s.name, s.id] }) %>
</div>
This works, but it will be tedious to do such things for every association in my application. I believe Rails has a way to automatically generate fields for associations, but I have no idea how this works. Is there such a thing?
Oh, and by the way, I already know about forests. If scaffolding needs to take care of what I describe above, I apparently am doing something wrong, because it does not for me.
(I'm on Rails 3.)
source
share