ruby on rails - How to create multiple records at once with ActiveScaffold in ROR -
i wanting use activescaffold create assignment records several students in single step. records contain identical data, exception of student_id.
i able override default form , replace dropdown box selecting student name multi-select box - want. change however, cosmetic, underlying code grabs first selected name box, , creates single record.
can suggest way accomplish in way doesn't require deciphering , rewriting of underlying activescaffold code?
update: still haven't found answer problem.
i suppose have defined multi-select box adding :multiple => true html parameters of select_tag. then, in controller, need access list of names selected, can this:
params[:students].collect{|student| insert_student(student, params[:assignment_id]) }
with collect applied array or enum can loop through each item of array, , need each student (in example, call function insert students). collect returns array results of doing code inside.
Comments
Post a Comment