Ruby, 5555 53 bytes
->n{n.times{|x|x.times{|y|w=*0|y|(w=*0...n;w[x],w[y]=y,x;pn)[w[x]=y]=x;p w}}}
0-based solution
The trick here is that the inner loop always "skips" an iteration: the first time it's not executed at all, then only once on the second pass, and so on.
I was happy with 55 bytes until I saw that R could be golfed down to 54, so I had to get it to 53.