Suppose this form:
假设这种形式:
<% form_for(@student) do |f| %>
<%= f.select(:subject_id,
options_from_collection_for_select(@subjects, :id, :name),
{:prompt => 'Select a subject' },
{:onChange => "#{remote_function(:update => :student_exam_id,
:url => {
:action => :update_exams_list,
:subject_id => 1
}
)
}" } ) %>
<%= f.select(:exam_id,
options_from_collection_for_select(@exams, :id, :title) ) %>
<% end %>
<% form_for(@stu