Additional patches for bug #6036

I submited additional patches (master and 3.0-stable) for bug #6036
because it was not fixed completely.

https://github.com/rails/rails/pull/147
https://github.com/rails/rails/pull/148

Robert Pankowecki

Applied, thanks!