app/controllers/participants_controller.rb
# Allow participant to change handle for this assignment
# If the participant parameters are available, update the participant
# and redirect to the view_actions page
Allow participant to change handle for this assignment
If the participant parameters are available, update the participant
and redirect to the view_actions page
Allow participant to change handle for this assignment If the participant parameters are available update the participant and redirect to the view_actions page
def change_handle
    @participant = AssignmentParticipant.find(params[:id])
    return unless current_user_id?(@participant.user_id)
    unless params[:participant].nil?
      if !AssignmentParticipant.where(parent_id: @participant.parent_id, handle: params[:participant][:handle]).empty?
        flash[:error] = "<b>The handle #{params[:participant][:handle]}</b> is already in use for this assignment. Please select a different one."
        redirect_to controller: 'participants', action: 'change_handle', id: @participant
      else
        @participant.update_attributes(participant_params)
        redirect_to controller: 'student_task', action: 'view', id: @participant
      end
    end
  end
def change_handle @participant = AssignmentParticipant . find ( params [ :id ] ) return unless current_user_id? ( @participant . user_id ) unless params [ :participant ] . nil? if ! AssignmentParticipant . where ( parent_id : @participant . parent_id , handle : params [ :participant ] [ :handle ] ) . empty? flash [ :error ] = "<b>The handle #{params[:participant][:handle]}</b> is already in use for this assignment. Please select a different one." redirect_to controller : 'participants' , action : 'change_handle' , id : @participant else @participant . update_attributes ( participant_params ) redirect_to controller : 'student_task' , action : 'view' , id : @participant end end end
Allow participant to change handle for this assignment
If the participant parameters are available, update the participant
and redirect to the view_actions page
Allow participant to change handle for this assignment If the participant parameters are available update the participant and redirect to the view_actions page