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, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url

Methods included from ApplicationHelper

#add_businesses_score, #base_url, #collection_amount_score, #completion_rate, #current?, #disk_filename, #get_businesses_chart, #handled_data, #handled_time_data, #handled_time_data_accurate, #relative_path, #signed_amount_score, #storage_path, #url_to_avatar, #visits_score

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