Any ideas on this would be grand
I have two models Degree and Qualification and am using a join table
called assigned, in my edit view below I am calling the partial ‘form’
at the start and then currently having to call my lines of code to edit
the assigned qualifications in the edit method itself because if I put
it in the partial it doesn’t pull through the current values of the
grade text field and the subject dropdown, ideally I want to put it into
the partial as my new view uses the same code
Edit view:
Editing degree
<%= error_messages_for :degree %>
<%= start_form_tag :action => ‘update’, :id => params[:id] %>
<%= render :partial => ‘form’ %>
Grade
<%=text_field 'assigned', 'grade' %>
<%@quals=Qual.find(:all)%>
Subject
<%=collection_select(:assigned, :qual_id, @quals,:id, :screen_qual,
:prompt => "Select a qualification")%>
<%= submit_tag “Edit” %>
<%= end_form_tag %>
<%= link_to ‘Show’, :action => ‘show’, :id => @degree %> |
<%= link_to ‘Back’, :action => ‘list’ %>
form partial:
<%= error_messages_for ‘degree’ %>
Title
<%= text_field 'degree', 'title' %>
Detail
<%= text_area 'degree', 'detail' %>
Careers
<%= text_area 'degree', 'careers' %>
Contact
<%= text_field 'degree', 'contact' %>
<% for interest in Interest.find(:all) %>