The page crashes when params[:admin][:unit] is either nil or contains an id that does not correspond to an actual unit. Similarly, a check for the shift validity is also probably necessary to make sure that params[:admin][:shift] is one of Unit.shifts.
The page crashes when
params[:admin][:unit]
is either nil or contains an id that does not correspond to an actual unit. Similarly, a check for the shift validity is also probably necessary to make sure thatparams[:admin][:shift]
is one ofUnit.shifts
.