Skip to content

Commit

Permalink
fix nil error
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushC committed Apr 22, 2024
1 parent 44777d5 commit 9016d22
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/controllers/teachers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ def update
return
end

# Attach the new files to the existing ones
params[:teacher][:more_files].each do |file|
@teacher.files.attach(file)
end

attach_new_files_if_any
send_email_if_application_status_changed_and_email_resend_enabled

if fail_to_update
Expand Down Expand Up @@ -278,6 +274,14 @@ def load_school
end
end

def attach_new_files_if_any
if params.dig(:teacher, :more_files).present?
params[:teacher][:more_files].each do |file|
@teacher.files.attach(file)
end
end
end

def teacher_params
teacher_attributes = [:first_name, :last_name, :school, :status, :snap,
:more_info, :personal_website, :education_level, :school_id, languages: [], files: [],
Expand Down

0 comments on commit 9016d22

Please sign in to comment.