app/controllers/requests_controller.rb
def request_params
    if params[:request]
      # sudo_user_ids always contain one empty element which must be removed
      params[:request][:sudo_user_ids].reject!(&:blank?)
      # the user_ids must contain the ids of ALL users, sudo or not
      params[:request][:user_ids] ||= []
      params[:request][:user_ids] += params[:request][:sudo_user_ids] if params[:request][:sudo_user_ids]
    end

    params.require(:request).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system,
                                    :port, :application_name, :description, :comment, :project_id, :port_forwarding,
                                    :rejection_information, responsible_user_ids: [],
                                    user_ids: [], sudo_user_ids: []).except(:template_id)
  end
# Never trust parameters from the scary internet, only allow the white list through.
# Modify parameters received from the request form
Never trust parameters from the scary internet, only allow the white list through.
Modify parameters received from the request form
Never trust parameters from the scary internet only allow the white list through . Modify parameters received from the request form
def request_params
    if params[:request]
      params[:request][:sudo_user_ids].reject!(&:blank?)
      params[:request][:user_ids] ||= []
      params[:request][:user_ids] += params[:request][:sudo_user_ids] if params[:request][:sudo_user_ids]
    end
    params.require(:request).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system,
                                    :port, :application_name, :description, :comment, :project_id, :port_forwarding,
                                    :rejection_information, responsible_user_ids: [],
                                    user_ids: [], sudo_user_ids: []).except(:template_id)
  end
def request_params if params [ :request ] params [ :request ] [ :sudo_user_ids ] . reject! ( & :blank? ) params [ :request ] [ :user_ids ] ||= [ ] params [ :request ] [ :user_ids ] += params [ :request ] [ :sudo_user_ids ] if params [ :request ] [ :sudo_user_ids ] end params . require ( :request ) . permit ( :name , :cpu_cores , :ram_gb , :storage_gb , :operating_system , :port , :application_name , :description , :comment , :project_id , :port_forwarding , :rejection_information , responsible_user_ids : [ ] , user_ids : [ ] , sudo_user_ids : [ ] ) . except ( :template_id ) end
Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet only allow the white list through .
# sudo_user_ids always contain one empty element which must be removed # the user_ids must contain the ids of ALL users, sudo or not