Displaying 1 result from an estimated 1 matches for "selected_projects".
2007 Apr 08
0
select html for habtm
...<p><label for="projects">Project</label><br/>
<select id="schedule_projects" name="schedule[project_ids][]"
multiple="multiple" size="10">
<%=
options_from_collection_for_select(@all_projects, :id, :name,
@selected_projects) %>
</select>
</p>
</div>
And my controller:
def edit
@schedule = Schedule.find(params[:id])
@all_projects = Project.find(:all, :order=>"name")
@selected_projects = @schedule.projects.collect{|prj|
prj.project_id.to_i}
end
def update...