app/models/in_progress_etd.rb
# If we see the committee_chair_attributes key in
# the new_data, then we assume that we are
# submitting data from the 'My Advisor' tab, so
# if (optional) committee members field is
# missing from the keys, we can assume the student
# deleted all the committee members off the form,
# and then we should delete the members from the
# cached data on the model.
If we see the committee_chair_attributes key in
the new_data, then we assume that we are
submitting data from the 'My Advisor' tab, so
if (optional) committee members field is
missing from the keys, we can assume the student
deleted all the committee members off the form,
and then we should delete the members from the
cached data on the model.
If we see the committee_chair_attributes key in the new_data then we assume that we are submitting data from the ' My Advisor ' tab so if ( optional ) committee members field is missing from the keys we can assume the student deleted all the committee members off the form and then we should delete the members from the cached data on the model .
def remove_blank_members(new_data)
    return unless new_data.key?('committee_chair_attributes')
    return unless new_data['committee_members_attributes'].blank?
    new_data['committee_members_attributes'] = []
  end
def remove_blank_members ( new_data ) return unless new_data . key? ( 'committee_chair_attributes' ) return unless new_data [ 'committee_members_attributes' ] . blank? new_data [ 'committee_members_attributes' ] = [ ] end
If we see the committee_chair_attributes key in
the new_data, then we assume that we are
submitting data from the 'My Advisor' tab, so
if (optional) committee members field is
missing from the keys, we can assume the student
deleted all the committee members off the form,
and then we should delete the members from the
cached data on the model.
If we see the committee_chair_attributes key in the new_data then we assume that we are submitting data from the ' My Advisor ' tab so if ( optional ) committee members field is missing from the keys we can assume the student deleted all the committee members off the form and then we should delete the members from the cached data on the model .
new_data
<not_specific>