Class: EducodeSales::CustomerExtensionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/educode_sales/customer_extensions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin, #authenticate_request, #current_user, #filter, #render_failure, #render_success

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/educode_sales/customer_extensions_controller.rb', line 6

def create
params[:school_ids].each do |d|
  if EducodeSales::CustomerExtension.find_by(school_id: d).present?
    EducodeSales::CustomerExtension.find_by(school_id: d).update(customer_staff_id: params[:staff_id])
  else
    EducodeSales::CustomerExtension.create(customer_staff_id: params[:staff_id], school_id: d)
  end
end
  render_success
end