Re-installing all gems automatically

Today while working on rails application I figured out that some of the gems are not configured/installed properly and it was creating strange problems and there older versions are also installed. So I decided to reinstall all installed gems.

But I wondered there is no way to automatically reinstall all the gems. What I have to do is first uninstall all the gems one by one then reinstall gems manually.