Um, lemme find the tutorial...
Basically, you have the Sim do homework, then pause the game. Put the tray part of the thingie on the floor and use move_objects to slide the Sim onto it. Lift the tray part (with the immobile Sim) onto the height adjuster part. Drag the whole assembly "into" the bed.
Tutorials:Taking_Totally_Bitchin_Pics:Posing_on_Su rfaces