Crash with AR 2.2.2

Hello

I used to have a very simple import routine,the full horror of which can
seen here, http://pastie.org/508105

As of an update in either AR 2.2.2 or AAF (I think it’s this, as I’d
been on 2.2.2 for a while), when I ever I call this index method I get
this when it gets to the rebuild_index part of the import method,
http://pastie.org/508107.

Does anyone know why this would be?

disclaimer, yes, I know the code suxx. Still learning this Ruby lark.

thanks in advance for anyone who can help

jp