Hi
I have two ojects @Parent @Child that i want to nest together to create
a select list for form.
@Parent @Child where @Parent has_many:Childern and Child
belongs_to:parent
In the db I have a field within child table call parent_id
I am using a form_for(@Parent...
and am using
<optgroup label="Parent">
<option value="1">Child name</option>
<option value="2">Child name</option>
<option value="3">Child name</option>
</optgroup>
<optgroup label="Parent2">
<option value="1">Child Name</option>
<option value="2">Child name</option>
</optgroup>
<%=
grouped_options_for_select(@Parent,Child.find(params[:parent_id]),:id,:name)%>
any help would be greatfull
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.