app/controllers/enrollment_controller.rb
# enroll the marked students in the contract
enroll the marked students in the contract
enroll the marked students in the contract
def create
    if @user.privilege < User::PRIVILEGE_STAFF 
      redir_error(TinyException::NOPRIVILEGES, @user)
      return    
    end
    count = 0
    params[:user].each do |key, value|
      student = User.find(key.to_i)
      Enrollment.enroll_student(@contract, student, @user, @privs)
      count += 1
    end
    flash[:notice] = "Thank you for enrolling #{count} participants."
    redirect_to enrollments_path(@contract) and return
  rescue TinyException => e
    flash[:notice] = e.message
    redirect_to enrollments_path(@contract) and return
  end
def create if @user . privilege < User :: PRIVILEGE_STAFF redir_error ( TinyException :: NOPRIVILEGES , @user ) return end count = 0 params [ :user ] . each do | key , value | student = User . find ( key . to_i ) Enrollment . enroll_student ( @contract , student , @user , @privs ) count += 1 end flash [ :notice ] = "Thank you for enrolling #{count} participants." redirect_to enrollments_path ( @contract ) and return rescue TinyException => e flash [ :notice ] = e . message redirect_to enrollments_path ( @contract ) and return end
enroll the marked students in the contract
enroll the marked students in the contract
# must have staff privileges to be here # enroll students # get the student # enroll the student    