Hey All,
I’m trying to play along w/the ‘complex forms 1’ railscast
(#73 Complex Forms Part 1 - RailsCasts) and having trouble. The view is
projects/new. I’m trying to add some project_people to the form w/code
like so:
<% form_for(@project) do |f| %>
[project stuff here]
<% for pp in @project.project_person %>
<% fields_for ‘project[proj_people_attributes][]’, pp do |pp_form|
%>
Person:
<%= collection_select(:pp, :person_id, Person.get_list, :id,
:nom, {:prompt => ‘Person?’}) %>
Role:
<%= select(:pp, :role, Person::ROLE_NAMES, {:prompt => ‘Role?’})
%>
<% end %>
<% end %>
<% end %>
I get the expected series of 3 s, but their names are not
automatically indexed. So I get:
Rather than this:
(At least I think that’s what they should be.)
Now, you may be saying to yourself “he’s got to call those select
helpers on the pp_form object that the fields_for block yields.” If I
do that, I get (e.g.): undefined method `merge’ for :nom:Symbol. So are
there different select helpers for using inside fields_for?
Many thanks!
-Roy
Roy P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee