Last time I ran into this problem, I found that the patch posted here:
http://dev.rubyonrails.org/ticket/10059 was able to fix it. You could
probably use the same method that patch does to solve your problem.
Sorry I can’t give you a direct answer, but I HTH