I assume that you have defined your field for multiple selection by adding: multiple => true for the select_tag html options. Then in the controller you need to access the list of selected names, which you can do as follows:
params[:students].collect{|student| insert_student(student, params[:assignment_id]) }
When the collection is applied to an array or enumeration, you can scroll through each element of this array and then do what you need with each student (in the example, to call the function to insert students). The collection returns an array with the results of code execution inside.
source share