MethodNotAllowed error when reloading routes on Rails 2.1

Hello,
I’m using Rails 2.1 on apache and in some functions of my application
I need to reload routes on the fly.
Now and then, it raises a MethodNotAllowed exception (“Only get, post,
put, and delete requests are allowed”), and after this my application
will not work at all until I restart apache.
This error doesn’t appear everytime when a specific function is called
but it just occurs sometimes.
I had some experiments to better understand the reasons of it, and it
looks like it’s a matter of time: if I call the routes reload on a
before filter, it occurs less often, and if I add a delay it occurs
even lesser.
This brought me to suppose that it happens if the routes reloading
isn’t still completed when the other operations on the page have
finished their work.
But obviously to try to guess how much it can take and to hope the
delay will be enough it’s not a solution at all.
How can I know when the routes reloading is completely ended? … it
may help, if I am right with my supposition.
Or can you suggest me how to solve this problem?

Thank you in advance.
Francesca.